Chapter 1 & 2 – 3 C++ Programs

Q1: 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.)

Q2: Write a program that prompts the capacity, in gallons, of an automobile fuel tank and the miles per
gallon the automobile can be driven. The program outputs the number of miles the automobile can be
driven without refueling.

Q3: A room has one door, two windows, and a built-in bookshelf and it needs to be painted. Suppose
that one gallon of paint can paint 120 square feet. Write a program that prompts the user to input the
lengths and widths of the door, each window, the bookshelf; and the length, width, and height of the
room (in feet). The program outputs the amount of paint needed to paint the walls of the room.

×
New Download