cin.get() cin.ignore()

I'm working on a Tic Tac Toe project for school that's due today and I'm writing notes for a Tic Tac Toe game my friend and I worked on together. Except I don't understand what the cin.ignore and cin.get part of it means/does.

1
2
3
4
5
6
{
			cout << "Invalid Move" << endl << "Press Enter To Try Again"; //if none of chosen options available becomes Invalid Move
			player++; //adds 1 to player to make sure it doesn't switch turns if player types in an invalid move
			cin.ignore(); //ignores wrong input
			cin.get(); //keeps the cout up until user intputs character
		}
For ingnore read this:

http://www.cplusplus.com/reference/istream/istream/ignore/
http://www.cplusplus.com/reference/istream/istream/get/

Both are waiting for the user input (it ends when the user hits enter) then read the input in that case ignore() reads one character and get() as well.
Topic archived. No new replies allowed.