I was doing some experimenting with cin.get() and cin.getline() and noticed a few things. Here is the code I was using to do the test:
Code:
#include <iostream>
using namespace std;
int main()
{
char ch[10];
char left[10];
cout<<"Enter characters."<<endl;
cin.getline(ch,10);
cin.getline(left, 10);
cout<<ch<<endl;
cout<<left<<endl;
system("PAUSE");
return 0;
}
With the code as it is, when I would enter more than 9 characters for the first input, it seems that any characters after 9 are simply thrown away. I'm assuming this is how that function functions. However, there is no chance for any second input. Can someone explain what is happening here?