Next: Exercises
Up: The if-else Statement
Previous: Multiple Choice Questions
x has the value 3.5 when the following statement is executed
what value would be assigned to y?if (x + 1 <= 3.6) y = 1.0; else y = 2.0;
if (x >= y) sum += x; cout << "x is bigger" << endl; else sum += y; cout << "y is bigger" << endl;
if-else statement which would add a variable x to a
variable possum if x is positive and would add x
to negsum if the variable x was negative.x is positive
then a variable poscount is incremented and if x is
negative a variable negcount is incremented. If this was part
of a program what would be sensible initialisations to carry out?