I can't understand, how we using operators if, else and anothers? I am Russian. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I can't understand, how we using operators if, else and anothers? I am Russian.

14th Sep 2016, 2:32 PM
sirojiddin
3 Answers
+ 3
when we use 'if' we enter a condition there if the condition is satisfied then the statement/expression we have given for 'if' is displayed. but if the condition is not satisfied then the statement/expression of 'else' is displayed.
14th Sep 2016, 2:37 PM
Ankit Ojha
Ankit Ojha - avatar
+ 2
if (condition) { //execute that code if the condition is true } else { //execute that code if the condition is false } A concrete example: int printParity(int n) { if (n%2 == 0) { cout << n << " is even!" << endl; } else { cout << n << " is odd!" << endl; } }
14th Sep 2016, 2:43 PM
Zen
Zen - avatar
0
thank you brother's! I have horstmans pdf book about c++, but I don't find concrete information about if, true, false, so you helped me easy understand what is it!!!
15th Sep 2016, 4:08 PM
sirojiddin