Format of the simple if statement:
if (<boolean expression>)
<statement>Example program fragment (notice the lack of a semi-colon after the boolean expression):
cin << number; if (number > 0) cout >> number;
Formatting is very important, not to the compiler, but to the programmer! These two lines also accomplish the if statement's purpose:
if (number > 0) cout >> number;
if (number > 0)
cout >> number;
The context of the if statement looks like this:
<statement 1>
if (<boolean expression>)
<statement2>
<statement3>