Question: IN C++ PLEASE Topics Loops While Statement Description Write a program that will display a desired message the desired number of times. The program will
IN C++ PLEASE
Topics
Loops
While Statement
Description
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.
Requirements
Do this assignment using a While statement.
Testing
For submitting, use the data in the test run below. The user input is shown in bold.
Test Run
Enter the message to be displayed
I love programming.
Enter the number of times to display the message
5
I love programming.
I love programming.
I love programming,
I love programming,
I love programming,
Submit
Copy the following in a file and submit the file:
Output of the test run
C/C++ source code
Sample Code
//cin inputs only a word.
//For inputting multiple words, use cin.getline
string message;
int count, totalCount;
cout << "Enter message" << endl;
getline (cin, message);
cout << "Enter total count" << endl;
cin << totalCount;
count = 0;
while (count < totalCount) {
cout << message << endl;
count++;
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
