Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write a program that uses a do-while loop. Within the loop you should get an integer input from the user via cin. You should then
Write a program that uses a do-while loop. Within the loop you should get an integer input from the user via cin. You should then echo (print back out) this value to the user with a message. The loop should end when the user enters -1. That is, your do-while loop should continue to run until the user enters -1. You will get no credit if you do not use a do-while loop. Also note, that the variable that will be holding your user input is best declared outside of the loop. Below are some sample runs of the program. User input is in bold italics. Sample run 1 You entered: 8 You entered: 5 You entered:-4 You entered:-1 Goodbye! Sample run 2 -1 You entered: -1 Goodbye! YOUR ANSWER We recommend you take a quick tour of our editor before you proceed. The timer will pause up to 90 seconds for the tour. Start tour O For help on how to read input and write output in C+ +.click here
Step 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