Bad Data checking in a loop, help?

I'll trying to add data checking in the overloaded function >> function below. I need to check that the user is inputing integers. If not I need to tell them to enter the correct datatype. It is for entering integers into a 2D array. I thought of putting a while ( ! (inputStream >> value)) into the second loop, but it messes up the size of my array when resuming putting integers into it? Any suggestions?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19

istream& operator >>( istream& inputStream, ARRAY& theArray){

	int userValue;
	
	cout << "Enter integers" << endl;
	

	for ( int i = 0, j = 0; i < theArray.arraySize; i++){
					
		for (int j = 0; j < theArray.arraySize; j++){
		
			inputStream >> userValue;

			theArray.arraySize[i][j] = userValue;
		}
	}
	return inputStream;
}
isdigit()?
Topic archived. No new replies allowed.