Uses a do...while loop to prompt the user to enter a count that is greater than 1 and less than or equal to 20 then reads in a count from the keyboard as an integer. a. If input error occurs or the count the user enters is less than or equal to 1 or greater than 20, output an error. After outputting an error, clear/ignore the failed input and continue do...while looping until a valid number is entered.

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter5: Repetition Statements
Section: Chapter Questions
Problem 9PP
icon
Related questions
Question

C++

 

pr
that.
1. Uses a do...while loop to prompt the user to enter a count that is greater than 1 and less than or equal to 20 then reads
in a count from the keyboard as an integer.
a.
If input error occurs or the count the user enters is less than or equal to 1 or greater than 20, output an error.
After outputting an error, clear/ignore the failed input and continue do...while looping until a valid number is
entered.
Transcribed Image Text:pr that. 1. Uses a do...while loop to prompt the user to enter a count that is greater than 1 and less than or equal to 20 then reads in a count from the keyboard as an integer. a. If input error occurs or the count the user enters is less than or equal to 1 or greater than 20, output an error. After outputting an error, clear/ignore the failed input and continue do...while looping until a valid number is entered.
Enter a count between 2 and 20
**failed
Error: Invalid entry, please retry
Enter a count between 2 and 20
**whoops
Error: Invalid entry, please retry
Enter a count between 2 and 20
**!
Error: Invalid entry, please retry
Enter a count between 2 and 20
**hello
Transcribed Image Text:Enter a count between 2 and 20 **failed Error: Invalid entry, please retry Enter a count between 2 and 20 **whoops Error: Invalid entry, please retry Enter a count between 2 and 20 **! Error: Invalid entry, please retry Enter a count between 2 and 20 **hello
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Types of Loop
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,