expand icon
book C++ Programs to Accompany Programming Logic and Design 8th Edition by Jo Ann Smith cover

C++ Programs to Accompany Programming Logic and Design 8th Edition by Jo Ann Smith

Edition 8ISBN: 978-1285867410
book C++ Programs to Accompany Programming Logic and Design 8th Edition by Jo Ann Smith cover

C++ Programs to Accompany Programming Logic and Design 8th Edition by Jo Ann Smith

Edition 8ISBN: 978-1285867410
Exercise 13
Using a Sentinel Value to Control a while Loop
In this exercise, you use what you have learned about sentinel values. Study the following code, and then answer Questions.
int numToPrint, counter;cout ? "How many pages do you want to print? ";cin numToPrint;counter = 1;while(counter = numToPrint);{cout ? "Page Number " ? counter ? endl;counter++;}cout ? "Value of counter is " ? counter ? endl;
Assuming you fix the problem, if the user enters 0 as the number of pages to print, how many pages will print?
Explanation
Verified
like image
like image

The " while " loop:
The "while" loop is...

close menu
C++ Programs to Accompany Programming Logic and Design 8th Edition by Jo Ann Smith
cross icon