Nested If … else statements, use braces
What about this?
int x = 5, y = 10;
if ( x > y)
if ( x > 0 )
cout << “x positive and x > y”;
else if ( x < 0)
cout << “x negative and x > y”;
else if ( x == 0)
cout << “cout << “x negative and x > y”;
else
cout << “x less than y”;
As soon as the program finds one of the boolean expressions to be true is executes the associated block of code and skips past the whole rest of the if … else block.