1.i am trying to check whether the cin.get() leaves the end line character in stream and considered it for next input. i have tried this code in code blocks but unable to provide input for next string,i am attaching code i have tried and the output .could anyone please explain.
#include<iostream>
using namespace std;
int main()
{
char s1[10];
char s2[10];
cout<<"enter the first string: ";
cin.get(s1,10);
cout<<"enter the second string: ";
cin.getline(s2,10);
cout<<s1<<" "<<s2;
return 0;
}
enter the first string: hello
enter the second string: hello
please explain the output
Aucun commentaire:
Enregistrer un commentaire