+ 1
What the output of this question? bool y=5; cout<<y/2<<endl;
All the numbers in the language c++, shall be true except zero is false
6 Antworten
+ 10
don't have a compiler to test it but I guess it will output 0.
bool y=5; => y=true;
cout << y/2 ( true / 2 = 1 / 2 = 0 ) << endl;
+ 2
yes the output is 0 ... thank you 🙂
+ 2
yes exactly it is 0! cool! never thought about it
+ 1
Yes, it is, but more,try this code
bool y=5; cout<<y;
So, All the numbers in the language c++ are true, but after store into bool variable there is only 1 value,
+ 1
We can make this kind program for java