Infinite loop issue

Hi there, I seem to be having a problem with an infinite loop in my program. My loop is supposed to ask for user input, but for some reason cin is not being recognized. If anyone knows how to solve this it would be greatly appreciated. Thanks!


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
void inputs(int board[x][y])
{
int coord1 = 0;
int coord2 = 0; 
int go;
	
	cout << "Now, let's play! Enter any input to start." << endl;
	cin.clear();
	cin.ignore(1000, '\n');
	cin >> go;

	system("cls");
	
	do 
	{
	   //cout << "X-Coordinate: ";
	   cin.ignore(1000, '\n');
	   cin.clear();
	   cin >> coord1;
	   if(coord1 == 100) break;
	  // cout << "Y-Coordinate: ";
	   cin.ignore(1000, '\n');
	   cin.clear();
	   cin >> coord2;
	   board[coord2-1][coord1-1] = 1;
	   print(board);
	}while(coord1 != 100);
   
}



Note: I am including the std namespace.
You are asking fin to ignore 1000 characters

read http://www.cplusplus.com/reference/istream/istream/ignore/
Topic archived. No new replies allowed.