2.5k views
4 votes
Assume that name has been declared suitably for storing names (like "Amy", "Fritz" and "Moustafa"). Assume also that stdin is a variable that references a Scanner object associated with standard input. Write some code that reads a value into name then prints the message "Greetings, NAMEVALUE!!!" on a line by itself where NAMEVALUE is replaced the value that was read into name. For example, if your code read in "Hassan" it would print out "Greetings, Hassan!!!" on a line by itself.

User Shaun Chua
by
8.6k points

1 Answer

4 votes

Answer:

void main(){

string name;

printf("Enter Name\\");

stdin("%s",&name);

Printf("\\Greetings %s",name);

}

Step-by-step explanation:

Here scanf is represented by stdin and we are using that scanner object to read the string value from user.The value which we read are printed in a new line using printf .The format specifier %s in printf is replaced by name variable

User Ramakrishna Joshi
by
8.8k points