My code is:
unsigned numbers, x = 0, odds = 0;
cout << "Input numbers to find the amount of odds. " << endl;
while ( x < 9999 ){
cin >> numbers || die("Input Error");
if (numbers % 2 == 1) {
odds++;
}
}
cout << "There are " << odds << " odds." << endl;
return 0;
How can I quit the loop when the user inputs a non-numeric value for numbers? Thank you in advanced.