The document contains a list of C++ programming tasks, including printing welcome messages, performing arithmetic operations, calculating sizes of data types, and manipulating user input. It also includes exercises on calculating VAT, rearranging code, averaging test scores, and converting time and temperature. Each task is designed to enhance understanding of C++ programming concepts and syntax.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
12 views2 pages
C++ Practise Questions
The document contains a list of C++ programming tasks, including printing welcome messages, performing arithmetic operations, calculating sizes of data types, and manipulating user input. It also includes exercises on calculating VAT, rearranging code, averaging test scores, and converting time and temperature. Each task is designed to enhance understanding of C++ programming concepts and syntax.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2
C++ QUESTIONS
1. Write a program in C++ to print welcome text on a separate line.
2. Write a program in C++ to print the sum of two numbers without using variables. 3. Write a in C++ program to find the size of fundamental data types. (char, short, int, bool, long, float, double) 4. Write a program in C++ to print the sum of two numbers using variables. 5. Write a C++ program to add two numbers and accept them from the keyboard. 6. Write a C++ program that swaps two numbers. 7. Write a C++ program that calculates the volume of a sphere. 8. Write a program to enable customers to know the VAT(value added tax) for any purchase price. VAT rate of 18% should be declared as constant, and the formula is VAT = 18.2% x price 9. Consider the following C++ program in which the statements are in the incorrect order. Rearrange the statements so that it prompts the user to input the length and width of a rectangle and output the area and perimeter of the rectangle. #include <iostream> { int main() cout << "Enter the length: "; cin >> length; cout << endl; int length; area = length * width; return 0; int width; cin>> width; cout << "Enter the width: " cout << endl; cout << "Area = " << area << endl; cout << "Perimeter = " << perimeter << endl; int area; using namespace std; int perimeter; } 10. Write a program that prompts the user to enter five test scores and then prints the average test score. (Assume that the test scores are decimal numbers.) 11. Write a program that does the following: a. Prompts the user to input five decimal numbers. b. Prints the five decimal numbers. c. Converts each decimal number to the nearest integer. d. Adds the five integers. e. Prints the sum and average of the five integers 12. Write a C++ program that prompts the user to input the elapsed time for an event in seconds. The program then outputs the elapsed time in hours, minutes, and seconds. (For example, if the elapsed time is 9630 seconds, then the output is 2:40:30.) 13. Write a C++ program to convert temperature in Celsius to Fahrenheit.