Problem

(Program) a. Write, compile, and run a C++ program that displays the following prompts:...

(Program) a. Write, compile, and run a C++ program that displays the following prompts:

Enter a number:

Enter a second number:

Enter a third number:

Enter a fourth number:

After each prompt is displayed, your program should use a cin statement to accept a number from the keyboard for the displayed prompt. After the fourth number has been entered, your program should calculate and display the average of the numbers. The average should be displayed in an output message. Check the average your program calculates by using the following test data:

Test data set 1: 100, 100, 100, 100

Test data set 2: 100, 0, 100, 0

After finishing your verification, use your program to complete the following chart:

b. Repeat Exercise 7a, making sure you use the same variable name, number, for each number input. Also, use the variable sum for the sum of the numbers. (Hint: To do this, you can use the statement sum=sum+number; after each number is accepted. Review the material on accumulating in Section 3.1.)

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
Solutions For Problems in Chapter 3.4