Nested If … else statements, example 1
•
int grade = 10;
•
if ( grade > 90 )
•
{
•
cout << “A”;
•
}
•
else if ( grade > 80 )
•
{
•
cout << “B”;
•
}
•
else if ( grade > 70 )
•
{
•
cout << “C”;
•
}
•
else
•
{
•
cout << “D or F”;
•
}
•
•
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.