Strings
In the previous lesson, using std::cin
with the >>
operator worked fine because the name was only one word. What if we need to input more than one word? We can use the std::getline
function like this:
std::getline(std::cin, my_string);
This will input one line of text to my_string
.
Your task is to create a program which takes one line of text containing the user's full name and then prints out Greetings, <full name>!
.
Thomas Cat
Greetings, Thomas Cat!