While Loop Exercise:
- Get a copy of the
- For visual studio users, you can click on the above link then copy and past it.
- For hercules users, you have the following options:
- Entering the cp command:
cp /net/data/ftp/pub/class/110/ftp/cpp/loop/count.cpp count.cpp
- or, using your mouse to copy and paste the program into pico text edit window.
- 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
hercules% CC count.cpp -o count
Please input the number of integers that you would like to add: 5
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
Copyright: Department of Computer Science, University of Regina.