Answer to Question #317287 in C++ for chim

Question #317287

Using a do while loop, write a program that will accept the name of the user and display “the user name” N number of times.


1
Expert's answer
2022-03-24T07:49:13-0400


#include <iostream>
#include <iomanip>
#include <string>
using namespace std;


int main()
{
	
	int i=1;
	int N;
	string name;
	cout<<"Enter N: ";
	cin>>N;
	cout<<"Enter the name: ";
	cin.ignore();
	getline(cin,name);
	do {
		cout<<name<<"\n";
		i++;
	} while (i<=N);


	


	system("pause");
	return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog