Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

c++ Not Secure cs.uregina.ca While Loop Exercise: Get a copy of the program count.cpp. The count.cpp program demonstrates how to use a while loop. Complete

image text in transcribed
c++
image text in transcribed
Not Secure cs.uregina.ca While Loop Exercise: Get a copy of the program count.cpp. The count.cpp program demonstrates how to use a while loop. Complete the program by following the instructions in the comments. Compile and run the program. Use the the following input values to test your program: loop total: 5 five numbers to be added 3, -2, 0, 9, 1. Here is a sample output 5 hercules[1] CC count.cpp -O count hercules [2] count Please input the number of integers that you would like to add: Enter an integer value: 3 Enter an integer value: -2 Enter an integer value: 0 Enter an integer value: 9 Enter an integer value: 1 The sum of the 5 integers is 11 b. Copyright: Department of Computer Science, Iniversity of Regina. // Program Count prompts for the number of integers to sum. // It then reads the integers in a loop, summing them. // Finally, it prints the sum. #include using namespace std; int main() int sum = 0; int dataValue; // summing variable // input value // add an int declaration statement here for the loop counter 11 add an int declaration statement here for the loop total // add an assignment statement here to set the loop counter to 0 11 add a cout statement here to prompt the user how many numbers 11 he/she wants to add i.e. the loop total // add a cin statement here to get the loop total // add a while statement here to test the loop counter against the loop total e.g. while (loopctrlooptotal) Note: the variable names depend on how you declared them. Press return." > dataValue; sum = sum + dataValue; // add a statement here to increment your counter variable } // end of while loop cout

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

Modern Datalog Engines In Databases

Authors: Bas Ketsman ,Paraschos Koutris

1st Edition

1638280428, 978-1638280422

More Books

Students also viewed these Databases questions

Question

3. Contrast relational contexts in organizations

Answered: 1 week ago

Question

2. Describe ways in which organizational culture is communicated

Answered: 1 week ago

Question

1. Describe and compare approaches to managing an organization

Answered: 1 week ago