use getline(cin, stringVariable);Originally posted by help_me
At school I am taking a c++ class, and in school we use codewarrior for the mac. At home tho I use Dev c++ (much better than codewarrior).
My problem occurs when I try to input to strings right after each other:
cout << "\nPlayer 1, please enter your name: ";
gets(player_1);
cout << "\nPlayer 2, please enter your name: ";
gets(player_2);
cout << endl << player_1 << " you are X\n";
cout << endl << player_2 << " you are O\n\n";
In codewarrior this works fine, but in dev c++ the output looks like this:
Player 1, please enter your name:
Player 2, please enter your name: joe
you are X
joe you are O
Press any key to continue . . .
it skips inputting the first players name, any body know why? I really appreciate any help... got to finish this by monday
rather than gets