#include <iostream>
#include <string>
using namespace std;
int main() {
// Declare variable to store name
string userName;
// Ask user for input
cout << "What is your name? ";
// Read name from keyboard
cin >> userName;
// Print greeting with name
cout << "Hello, " << userName << "!" << endl;
return 0;
}
``` The cin statement waits for you to type something and press Enter, storing your input in userName. Then cout builds the greeting by chaining together fixed text and the variable content.
##### ###### ##### ### # # ### # # ###### ## ## ## ## ## ## ## # # # # # ## ##### #### ##### # # # # # # # #### ## # ## ## ## ## # # # # # ## ## # ###### ## ### # ### # ######
$ curl repovive.com/roadmaps/cpp/getting-started/hello-name-implementation
░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░██████████████████████████████████████████████████████████████████████████