The teacher say that whenever the c
value is negative it say: " the a number is negative" but it doesn't make sense.
Is the program written in the wrong form?
In my opinion else should be part of the if(a>0)
with {}
i don t know why he choose to not use it.
In conclusion, is the correct form like: if(a>0){...}else
and than cout
?
#include <iostream>`
using namespace std;
int main(void) {
int a, b, c;
cin >> a;
cin >> b;
cin >> c;
if (a > 0)
if (b > 0)
if (c > 0)
cout << "they are all positive";
else
cout << "the number a is negative";
}
Aucun commentaire:
Enregistrer un commentaire