C++ program to scan name of user and say hello with name
Following program shows you how to scan name of user and say hello with name
In this program we get name from user using std::cin
method and prints hello with that name using std::cout
#include <iostream>
#include <string>
int main() {
std::string name;
std::cout << "Please enter a name:";
std::cin >> name;
std::cout << "Hello " << name;
}
Output:
Please enter a name: Tom
Hello Tom