i have a program that has one little glitch but i dont know how to fix it. If you can help it would be great.
[/b]
int main()
{
int a, b, c;
b=0;
c=0;
do
{
cout << "Please enter a positive integer (negative integer to stop):"<< ' ';
cin>> a;
if (a%2 == 0)
{
c++;
}
else
b++;
}
while (a>=0);
cout << "You have entered" << ' '<< b << ' ' <<"odd numbers." << endl;
cout << "And" << ' ' << c << ' ' <<"even numbers." << endl;
system("PAUSE");
return 0;
}
[b]
here is the program. the problem is if i put in these numbers 3,1037,60,-43. i get a answer of 3 odd numbers and 1 even numbers. it should say 2 odd and 1 even. the program is counting the negative number as an odd where it should just end the program.