Answered step by step
Verified Expert Solution
Link Copied!

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. image text in transcribed

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 lab

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

Put Your Data To Work 52 Tips And Techniques For Effectively Managing Your Database

Authors: Wes Trochlil

1st Edition

0880343079, 978-0880343077

More Books

Students also viewed these Databases questions

Question

Explain how a firm can hedge its translation exposure.

Answered: 1 week ago

Question

Is the person willing to deal with the consequences?

Answered: 1 week ago

Question

What are the Five Phases of SDLC? Explain each briefly.

Answered: 1 week ago

Question

How can Change Control Procedures manage Project Creep?

Answered: 1 week ago