Question: #include using namespace std; int main() { int num; cout < < Enter numbers, 999 to quit:; cin >> num; while (num != 999) {

#include

using namespace std;

int main()

{

int num;

cout << "Enter numbers, 999 to quit:";

cin >> num;

while (num != 999)

{

cout << "Enter numbers, 999 to quit:";

cin >> num;

}

system("pause");

return 0;

}

1.Type in the program above

2.Add the steps to total the numbers entered. (First create the variable before the loop to hold the total and assign zero to it before the loop, then inside the loop, add num to the total variable and save it back in total)

3.Add the steps to count how many numbers were entered (First, create the variable called count before the for loop with an initial value of zero, then inside the loop increment it by 1)

4.After the loop (outside of the body of the loop), add the steps to compute the average. (use the total and count variable to find the average)

5.Test the program with different values.

6.Re-run the program, the first time it asks you to enter a number, enter 999 and check the output of the program for the average.

7.Add an if statement before calculating the average, to prevent division by zero error that happens in step 6.

I am trying to figure out this question through the steps but I don't even know if my code is working right, it's really messy and I'm just overall confused

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!