Question
C++ Homework Help! Orriginall Assignment: Write a program that will display a desired message the desired number of times. The program will ask the user
C++ Homework Help!
Orriginall Assignment: Write a program that will display a desired message the desired number of times. The program will ask the user to supply the message to be displayed. It will also ask the user to supply the number of times the message is to be displayed. It will then display that message the required number of times.
New Assignment:
Redo the previous assignment. However, this time, first ask the user to supply the number of times the message is to be displayed and then ask the user to provide the message to be displayed. In other words, reverse the input sequence (first input the count and then the message). Does the program work? By doing the cin first and getline afterwards, the program input wont work correctly. Correct it by adding a cin.ignore( ); after cin statement and before getline statement.
After the program works, turn it in.
Also, in a paragraph, describe, why the program input doesnt work correctly when, after the cin statement, there is a getline statement.
In another paragraph, describe how you corrected the problem.
For each of the code fragments below, answer if the contents of count and message provided are correct or incorrect.
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