string s = "HackerRank ";
string s2;
getline(cin, s2);
s+=s2;
cout<<s;
for input:
is the best place to learn and practice coding!
it is giving output:
HackerRank the best place to learn and practice coding!
Can someone pleasee help me understand why it is giving this problem?
It is however working with:
string s = "HackerRank ";
string s2,ws;
cin>>ws;
getline(cin, s2);
s+=ws;
s+=s2;
cout<<s;
It is giving the expected output:
HackerRank is the best place to learn and practice coding!
for the same input
Aucun commentaire:
Enregistrer un commentaire