Tuesday, 22 May 2018

C++ Fundamentals Practice Questions 3

Fundamentals of programming

Q1) Write Algorithm and then a complete C++ program that will calculate the total rate of receiving dollars for each bushel. You have to take total number of dollars you have received and total number of bushels for  which you get dollars as inputs from user, and then display the result up to two decimal places in following format:

For Example:
You have received “$ 12.53 “for each bushel ……

Note: Select Appropriate data types and names.
Hint: rate=dollars/bushels
Bushel is the British unit of volume for dry objects, like bushels of corn, bushels of wheat etc.

Q2) Write and algorithm and then a complete C++ program that ask user to enter any positive integer and then calculates its 4th power and display the result as (if user entered 3)

4th power of 3 = 3*3*3*3 = 81

Q3) Use showpoint manipulator before displaying output in above question.

Q5) Write and algorithm and then a complete C++ program that calculates the product of any three integer values input by user using a single cin statement and display their product by using appropriate message.

Q6) What will be the value of each of the following variables after its initialization?

double  d = 2 * int(3.14);
long    k = 3.14 - 3;
char c = 'a' + 2;
char c = 'p' + 'A' - 'a';

 Q7) Write sample program of fixed and showpoint manipulator you have done in class.

No comments:
Write comments