Assume that name has been declared suitably for storing names (like “Misha”, “Emily” and “Sofia”) Write some code that reads a value into name then prints the message “Greetings, NAME ” where NAME is replaced the value that was read into name . For example, if your code read in “Rachel” it would print out “Greetings, Rachel”.

4
Assume  that name  has been declared  suitably for storing names  (like “Misha”, “Emily” and “Sofia”) Write some code that reads a value  into name  then prints the message  “Greetings, NAME ” where NAME  is replaced the value  that was read into name .  For example, if your code read in “Rachel” it would print out “Greetings, Rachel”.

LANGUAGE: C++

CHALLENGE:

Assume  that name  has been declared  suitably for storing names  (like “Misha”, “Emily” and “Sofia”) Write some code that reads a value  into name  then prints the message  “Greetings, NAME ” where NAME  is replaced the value  that was read into name .  For example, if your code read in “Rachel” it would print out “Greetings, Rachel”.

SOLUTION:


cin >> name;
cout << "Greetings, " << name;

4 comments

Add comment