C++ Fundamentals Practice Questions 2 - Wisdom Lighter

Tuesday, 22 May 2018

C++ Fundamentals Practice Questions 2


Fundamentals of Programming

Q1)  Write a complete C++ program that declares two integer variables named gallons
         and liters, and then takes no of gallons as an input from user and convert it into  
         liters using the following formula:
Liters = gallons * 4

        The program should display the output in the following format (if gallons entered =4):

4 gallons is equal to 16 liters.

Q2) Modify the above program by using floating point numbers.

Q3) Write a complete C++ program that declares two variables of type char and int
        respectively. Then take input from user in integer variable and assign that variable to char    
        variable and display that char variable in the following format ( if user entered 97 in int
        variable then after assigning integer  variable to char variable output would be like this )

The value of character is a.

Note: Before writing program write down its algorithm in C++ file in comments (/* and */) at the top.

Q4) Write a complete C++ program that ask the user to enter and integer value and then
        calculates its double and display output in the following format (if user enters 702)

The value you entered is 702 and its double is 1404.

Note: Before writing program write down its algorithm in C++ file in comments (/* and */) at the top.

Q5) Write a complete C++ program to enter Roll No, Marks of three subjects Math, Physics
        and Chemistry and then after clearing output screen display the result sheet in the
        following format.

************
Result Sheet
************

Student’s Roll No.                      Math               Physics           Chemistry        Total
----------------------------------------------------------------------------------------------------------

          2357                                     99                       85                       97                281

----------------------------------------------------------------------------------------------------------

No comments:
Write comments