Answered step by step
Verified Expert Solution
Question
1 Approved Answer
C++ Please. Write a complete program that: 1. Uses a do...while loop to prompt the user to enter a count that is greater than 1
C++ Please.
Write a complete program 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 10000 then reads in a count from the keyboard as an integer. If input error occurs or the count the user enters is less than or equal to 1 or greater than 10000, output an error. After outputting an error clear/ignore the failed input and continue do...while looping until a valid number is entered. 2. Uses a for loop to find the sum of all of the even numbers from 1 to the number input in (1). 3. Uses a while loop to find the sum of all of the odd numbers from 1 to the number input in (1), Your program must handle the possibility that the user accidentally enters a character or out of bounds number. If a character o an out of bounds number is entered the stream should be cleared, any previous values read should be discarded, an error displayed, and the user prompted again. The program should not exit until good values have been entered. A do...while loop must be used to take in input. A for loop must be used to sum the even numbers. A while loop must be used to sum the odd numbers. Failure to do so will result in a 0 for this labStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started