Chapter 2
Chapter 2
Multiply speed by time and store the result in the distance variable.
Convert the following pseudocode to C++ code. Be sure to define the appropriate variables.
Divide area by force and store the result in the pressure variable.
Q2:
Write a program that displays the following pieces of information, each on a separate line: Your name
Your address, with city, state, and ZIP code Your telephone number Your college major Use only a single
cout statement to display all of this information.
Q3:
To get the average of a series of values, you add the values up and then divide the sum by the number of
values. Write a program that stores the following values in five different variables: 28, 32, 37, 24, and 33.
The program should first calculate the sum of these five variables and store the result in a separate
variable named sum. Then, the program should divide the sum variable by 5 to get the average. Display
the average on the screen.
Q4:
Write a program that computes the tax and tip on a restaurant bill for a patron with a $88.67 meal
charge. The tax should be 6.75 percent of the meal cost. The tip should be 20 percent of the total after
adding the tax. Display the meal cost, tax amount, tip amount, and total bill on the screen.