Hello I want my program to count the number of even and odd numbers inputed by the user, but it does not work. I want them to be able to input more than one integer. Thanks for your help. Example of output: There are 8 even numbers in the array.
int main()
{
int integer;
int odds = 0;
int evens = 0;
// integer and obtain integer.
while (true) {
cout << "Please enter an integer\n";
cin >> integer;
if (integer == 0) break; // break outa here
// determine if integer is even or odd
if (integer % 2 == 0)
evens++;
else
odds++;
} // end of while loop
cout << " Number of even numbers: " << evens << endl;
cout << " Number of odd numbers: " << odds << endl;
return 0;
}