Say you need to store a persons First name and last Name. I know I could do so by:
string firstname;
string lastname;
string fullname;
cout << "Users firstname ? "; cin >> firstname;
cout << "Users last name ? "; cin >> lastname;
fullname = firstname + ' ' + lastname;
I would like to eliminate the two extra variables and the concatenation at the end.
I want to be able to continue input on a buffer before storing it in the variable.
Is there a way to do this?
Aucun commentaire:
Enregistrer un commentaire