Format of the compound if . . . else statement:
if (<boolean expression>) { <statement> . . . <statement> } else { <statement> . . . <statement> }
Example code fragment:
if (denominator != 0) { ratio = numerator / denominator; cout << "The ratio is " << ratio; cout << endl; } else { cout << "Can't divide by zero."; cout << "The ratio is undefined."; cout << endl;