coin collection
Rob is fond of collecting coins but unfortunately,sometimes he has to sell a coin to get other coins.he puts all his coins one over the other in a column.
There can be 2 types of Operations:
(0,i):Add coin with value i to the collection.
(1,0):sell a coin.
Selling a coin:
For selling a coin ,he picks up the top coiin in the coloumn if he constraint A is satisfied.Constraint A:Rob can only sell the coin if the coin collection value is more than Y.
Upon emoval ,the coin collection value goes to the previous value.Initially,with 0 coins ,coin collection value is 0.
Adding a Coin:
on addong a coin of value i to the collection the coin collection value increments via the following prodcedure.
If the coin collection had>=X value then current total value is X+i else X+2*i.
Rob needs to find and return the final value of coin collection after Q operations.
Note : Initially,the value X is 0 and not X.
Example1:
input1:10
input2:0
input3:1
input4:{{0,5}}
output:10
Greedy Businesssman:
Sam is a greedy businessman who has opened N stores in a city.at various locations.
The locations of stores are stored in 1 2-Dimensional array.the coordinates of ith store are defined as follows:
starting point would be input[0][i] and ending location would be input[1][i].
for example:when i=0,input[0][0]=2 and input [1][0]=5,it means that the 0th store spans from 2 uniits to 5 units.
The greedy businessman wants to set up warehouse =s which can supply goods to these stores.
A warehouse can only be set up at a good location.A location is said to be good location if it is lying in the ranfe of [a,b],where a denotes the starting unit of a store and b denotes the end unit of any store S(a,b).
for example: a location ‘X’ is a good location with respect to the store (a,b) ifa<==X<=b.
Note:there can be more than one stores located at a particular.
Example1:
input1:2
input2:{{1,2},{3,5}}
output1:1
Write short answers for each of the following:
(a) Name the operator that is used to declare a pointer variable.
(b) If pt is an integer pointer variable, what is the value that this pointer variable can have? (c) List the three values that can be used to initialize a pointer variable.
(d) Name and give the symbol of the operator that returns the location in memory where its operand is stored.
create a console application in area of the square
Write a program to take input for n number of doctor records and write records of all cardiologists in a file named: “record1”. Also write records of all those doctors in another file named: “record2” who are taking salary more than INR 80,000. After writing records in both files, merge their contents in another file: “finalrecord” and read all records of “finalrecord” file and display on screen. [Attributes of doctor: doc_id, doc_name, doc_specialization, doc_salary]
Type a number: 5
Type another number: 2
Sum is :7
Write a C++ Program to Find Grade of a Student using if else.
Write a program to perform basic to class conversion [Such as there is a class named: "conversion" with data members: feet and inches (both int)] Convert basic type(int) height in terms of total number of inches into equivalent feet and inches (class type) and display output on screen.
Discuss constructors with default arguments and constructor overloading with the help of suitable examples
Write a program to perform basic to class conversion [Such as there is a class named: “conversion” with data members: feet and inches (both int)] Convert basic type(int) height in terms of total number of inches into equivalent feet and inches (class type) and display output on screen.