0
I can't understand, how we using operators if, else and anothers? I am Russian.
3 Antworten
+ 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.
+ 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;
}
}
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!!!