Electrical and Computer Engineering
18
of 21
UAH
CPE 112
if
Statement Examples
(If-Then-Else Form)
if
(hours <= 40.0)
pay = rate * hours;
else
pay = rate * (40.0 + (hours 40.0) * 1.5);
cout << pay;
if
(divisor != 0)
result = dividend / divisor;
else
cout << Division by zero is not allowed. << endl;