Hey guys.
I need some help on input validation in an array. The program can only input numbers but not characters.
This is the code for the input. ( I know im a newbie lol )
const arraysize = 10;
float num[arraysize];
for ( int i = 0; i < 10; i++ ){
cout << endl << "Enter number " << i + 1 << " :\t";
cin >> num[i]; //Array input
}
I need to produce an error message and break out from the program when the input is not a number (character etc). The program is in a function.