Write the function definition for a function which asks the user for their name and then prints a personalized greeting. DO NOT WRITE AN ENTIRE PROGRAM. DO NOT WRITE THE STATEMENT THAT CALLS THE FUNCTION JUST WRITE THE FUNCTION DEFINITION
//Function for asking user name
void userDetails(){
//Asking user first name ,surname and lastname using c++
string firstName;
string surName;
string lastName;
cout<<"Enter your first name"<<endl;
cin>>firstName;
cout<<"Enter your surname"<<endl;
cin>>surName;
cout<<"Enter your last name"<<endl;
cin>>lastName;
//Displaying the greetings for particular user
cout<<"Hello Mr. "<< firstName <<" "<< surName <<" "<< lastName <<endl;
}
Get Answers For Free
Most questions answered within 1 hours.