Answer to Question #229313 in C++ for Vishnukumar

Question #229313
write a c++ program to display your name,mobile no,reg no,college studying and address...
1
Expert's answer
2021-08-24T16:59:36-0400
#include <iostream>
using namespace std;
int main()
{
	string name, regNumber, college, address,mobileNumber; /* Have used string data type for all variables since student name and college name are strings, 
	 														Reg number may contain an alphabet, 
															Mobile number may contain + sign 
															and address may contain aname
														   */
	
	
	cout<<"\n Enter your name (e.g. Bonface):  ";
	getline(cin, name);
	
	cout<<"\n Enter your mobile number (e.g +xxxx xxxx 777): ";
	getline(cin, mobileNumber);
	
	cout<<"\n Enter your Registration number (e.g. BIT/M/0002777/2020):  ";
	getline(cin, regNumber);
	
	cout<<"\n Enter college name (e.g. Harvard):  ";
	getline(cin, college);
	
	cout<<"\n Enter your address (e.g. xxxx, fake street, city):  ";
	getline(cin, address);
	
	cout<<"\nHere is the details you entered \n";
	cout<<"NAME"<<"\t\t"<<"MOBILE NUMBER"<<"\t\t"<<"REG NUMBER"<<"\t\t"<<"COLLEGE"<<"\t\t"<<"ADDRESS"<<"\n\n";
	cout<<name<<"\t"<<mobileNumber<<"\t\t"<<regNumber<<"\t\t"<<college<<"\t\t"<<address<<"\t";


	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
APPROVED BY CLIENTS