if (boolean expression) { statement; }
cout << "Enter the hours worked " ; cin >> hours; cout << "You entered " << hours << " hours" << endl; if (hours >= 40) { cout << "You worked overtime "; overtime = hours - 40; }
if (boolean expression) { statements } else { statements }
if (hours > 40 ) { cout << "You worked overtime" << endl; overtime = hours - 40; } else { cout << "You didn't work overtime " << endl; overtime = 0; }
if (hours > 40) overtime = hours - 40;
x = 4; if (x = 7) { cout << "X is seven" << endl; }
x = 4; if (7 = x) { cout << "X is seven" << endl; }
if (condition) { cout << "DEBUG I am in the THEN part " << endl; other statements } else { cout << "DEBUG I am in the ELSE part " << endl; other statements }
Salary | Rate |
< 10,000 | 0% |
10,001 < S < 20,000 | 7% |
20,001 < S < 30,000 | 9% |
30,001 < S < 40,000 | 12% |
40,001 < S | 15% |