Question: Write a C++ program that has a while-loop to loop indefinitely until an input of a value that is 0 or less. Hence, prompt

Write a C++ program that has a while-loop to loop indefinitely until

Write a C++ program that has a while-loop to loop indefinitely until an input of a value that is 0 or less. Hence, prompt user to enter a positive integer value and repeat as long as it is greater than 0. Here is start of the code 2 #include #include 34 3 using namespace std; 4 5 6 int num; 7 8 9 19 int main() { int sum = 0; int count = 0; double average; When exit the loop, calculate and then display the average to 2 decimal places. Remember that the values for variables sum and count depends on how many values entered. Here is a sample run of the complete program Enter an integer : 8 Enter an integer : 10 Enter an integer : 9 Enter an integer : 7 Enter an integer : Enter an integer : 5 Enter an integer : -5 Average is 7.33 (Ctrl)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

You can achieve the desired functionality using a whileloop to continuously prompt the user ... View full answer

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 Operating System Questions!