Here is source code of the C++ program which prints the name of the user using streams. The C++ program is successfully compiled and run on a Linux system. The program output is also shown below.
* C++ Program to Print the Name of the User using Output Stream
std::cout << "Hello User, Enter your first name.\n ";
std::cin >> firstname;
std::cout << "Hello " << firstname
<<". It was nice to know your name!\n";
$ g++ main.cpp $ ./a.out Hello User, Enter your first name. George Hello George. It was nice to know your name!
Sanfoundry Global Education & Learning Series – 1000 C++ Programs.