-
cin.getline hanging up
Hi,
In my program, I have something like this:
cout << "Enter something: ";
cin >> something;
...
cout << "Enter something else: ";
cin.getline (something_else, 128);
Why is it that my program hangs up on the cin.getline when I have the first cin called? If I remove the first callout of cin, then the program works fine.
I've tried cout.flush(), thinking that it might work but it didn't.
Can someone please help?
-
just change
cout << "Enter something: ";
cin >> something;
to
cout << "Enter something: ";
cin.width( 128 );
cin >> something;