1/18/00
COM1100 Winter2000 Yuhong Yin
Northeastern University
20
if
statement
-- 4
n
Condition also can simply be a variable
n
if ( x )
// same as if ( x != 0 )
n
result = sum / x;
n
Examples
n
int x = -5;
n
if ( x )
n
cout << “Good Morning !” << endl;
n
else
n
cout << “Good Afternoon !” << endl;
n
n