1/18/00
COM1100 Winter2000 Yuhong Yin
Northeastern University
19
if
statement
-- 3
n
Condition is sometimes a mathematical expression
n
int x
= 5;
n
int y = 3;
n
int sum = 14;
n
int result;
n
if ( x - y
)
// equals to if ( (x-y) !=0 )
n
result = sum / (x - y );
n
else
n
cout << “Error: Divided by zero ! \n”
n