+ 1
For + the variable is sum what is the variable for < >
7 Respuestas
+ 3
Nazeekk
You need to place them in parenthesis, and then they will output 0 for false or 1 for true.
cout << (5 > 6); // outputs 0
cout << (5 < 6); // outputs 1
etc
+ 3
Nazeekk
Oh, and if you really wanted to output true or false instead then you could use a ternary like;
cout << (5 < 6? "true": "false");
+ 2
Nazeekk
No worries, I'm pretty rusty and was never really great at c++
+ 1
Thats conditional operator. They're needed to check the statement. Just like
cout << 5 > 6;
//output will be "false"
cout << 5 < 6;
//output will be "true"
cout << 5 == 5;
//output will be "true"
cout << 5 == 6;
//output will be "false"
cout << 5 != 6
//output will be "true"
cout << 5 != 5
//output will be "false"
+ 1
ouch, im sorry, in c++ it doesn't works with "cout". But anyway, you can do the same using "if" statement
+ 1
for example:
if(6 > 5) {
cout<<"6 is greater then 5";
}
else if(6 < 5) {
cout<<"5 is greater than 6";
}
//output gonna be "6 is greater than 5"
0
ChaoticDawg
Thanks for it. Im kinda bad in C++😃😃