I am trying to store as many numbers in the array and check if there is only 2 integers. I know it sounds stupid to use an array but I am just practicing to learn how to use size of array for other different things like odd/even/negative/non-negative..etc..!!
Well if you want to store the number into a array directly you could use a loop like this
1 2 3 4 5 6
// Use size_t when making a index for a array. Also SIZE is the array's size.
for (size_t i = 0; i != SIZE; ++i)
cin >> myArray[i];
That will read the users input directly into the arrays elements. Then if you wanted to keep track of how many times the user inputted numbers you could make a counter that keeps track of it. If that is what you are asking, if not let me know.
Huh how could the array be bigger then SIZE? and it stops 1 before SIZE.
Anyways I am not sure I understand what the OP is trying to do to. I don't really get the part of storing as many number in the array and the checking if there is only 2 integers parts.
Maybe that is why my example wont work? Otherwise it does what I believed he wanted just fine (Grab user input and put that input into the array), though now that I look at it again there is no point for the counter since it will always equal SIZE - 1 since there is no other way to break out of the loop.
i guess you want the input to contain 2 digits only no less or more not 2 ints if that's what you mean here is how:
any number contains 2 digits only should be between the values 10-99 so you can test the input to be larger than 9 and smaller than 100.
I hope this is what you want.