Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

Step: 1

You can achieve the desired functionality using a whileloop to continuously prompt the user ... blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Income Tax Fundamentals 2013

Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill

31st Edition

1111972516, 978-1285586618, 1285586611, 978-1285613109, 978-1111972516

More Books

Students also viewed these Operating System questions

Question

Define line and staff authority

Answered: 1 week ago

Question

Define the process of communication

Answered: 1 week ago

Question

Explain the importance of effective communication

Answered: 1 week ago

Question

* What is the importance of soil testing in civil engineering?

Answered: 1 week ago