Hi,Today we make program in Which we ask the users name and address and display the input data in the screen. Get line Command in C++.The User Enter name and Address and Get Result.
Name and Address and Display the input data in the screen Get line Command in C++
#include <iostream>
using namespace std;
int main()
{
string name, address;
cout << "\n\n";
cout << "Enter you name : ";
getline(cin,name);
cout << "Enter your home address: ";
getline(cin,address);
cout << "\n\n";
cout << "Hi " << name;
cout << "\n\n";
cout <<"You present home address is " <<address;
cout << "\n\n";
cout << "\tEnd of Program";
cout << "\n\n";
}
Output of program
Enter you name : Bilal Tahir Khan Meo
Enter your home address: Pattoki,Lahore,Pakistan
Hi Bilal Tahir Khan Meo
You present home address is Pattoki,Lahore,Pakistan
End of Program