vendredi 11 septembre 2015

c++ not recognizing negative number as a number entered

In a program I have to write for class, I can not get the code to read a negative from cin to increment a variable by one.

int input;

while (input != 9999)
{
    sum += input;
    count ++;
}

There is other code that counts the number of pos, neg, and zeros entered. this is the only place count is used. so if I enter -10 then 9999, the sum is -10 and the number of negative is 1 but count says zero. i am using dev c++ as a compiler. and windows 10



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire