0
Help putting this code to work.
2 ответов
+ 7
You were using name before actually taking input from the user. This will cause name giving output of garbage value. In order to properly print out name and last name , girt get the input from the user and then use it in last cout statement.
int main()
{
string name, last;
cout << "What is your name"<<endl;
cin >> name;
cout << "What is your last name"<<endl;
cin >> last;
cout << "welcome back" << name << last << endl;
return 0;
}
+ 1
Did you observe that you're using integers to write names? They need to be strings, otherwise it will give an error from input for TypeCompatibility.