I am new to c++ and finding it difficult to use strings.User is inputting his full name i.e firstname and lastname seprated by space and i want to store it in different strings while he inputs his name
Input
ABC XYZ
Code
string s1,s2;
getline(cin,s1);
getline(cin,s2);
cout<<"Firstname :"s1<<endl;
cout<<"Lastname :"s2<<endl;
Output
Firstname :ABC XYZ
Lastname : //nothing is printed here , i want to sore the last name here
Aucun commentaire:
Enregistrer un commentaire