11th Feb 2019, 5:54 PM
Jesu
Jesu - avatar
2 Answers
+ 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; }
11th Feb 2019, 6:04 PM
Frost
Frost - avatar
+ 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.
11th Feb 2019, 7:00 PM
Charlie S
Charlie S - avatar