Yes, that's because, you are giving an int(integer) type, alphabets, instead of integers.
This sets the badbit flag, and your programme starts to mess-up.
It would be better, if you cin>> in the char(ie: q)
An identifier, is not the same as a value. while(choice!=q)?? When choice and q do not even have values. This is the correct code, and if you want explanation, maybe tomorrow or from the other guys cause my eyes are heavy.
#include <iostream>
using namespace std;
int main()
{
char input;
do
{
cout«"Enter a number-q to quit: "j
cin»input;
if(input>0)
cout«"\nGood";
else cout«"No negatives allowed";
}while(input!='q');
return 0;
}
Sorry for not using code tags cause I am not on my desktop computer, also, cannot type more......zzzzz............
I try to run this, but whenever I input a negative number (or any letter that is not q by the way), it gives me the same result as if I had put a positive number...
That's why I was hesitating about using char for my cin>>, because I need this to make a distinction between positive numbers, negative numbers, and letters...