double PAYRATE_THRESHOLD= 12.00;.….….if (payrate >= PAYRATE_THRESHOLD);This is to avoid missing replacement.const double PAYRATE_THRESHOLD= 12.00;PAYRATE_THRESHOLD= 13.00 //Error! Wont compile.---------------------------------------------------------------------------------------------------------------------------if (age == 18 || 19 || 20) //compiles, but doesn’t mean what you expectedThe theory below explains 19 and 20 represent true statementsint n = 17;cout << “n is “ << n << end1;if (n=0)cout << “ n is zero” << end1;else cout << n is not zero; n is “ << n << end1;n Is 17n Is not zero; n is 0.***In a context where a true/false value is required and a number is given, 0 is treated as false , and any non-zero value is treated as true.***De Morgan’s lawsnot (A or B) (not a) and (not B)not(A and B) (not A) or (not B)not (a > b) a <= bnot ( a >= b) a< bnot (a < b) a >= bnot(a <= b) a > bnot (a == b) a!= bnot (a !=b) a ==b………………………………………………………………………………………………………………………………………if (income < 30000)cout << “Low”;else if (income < 80000)cout << “Middle”;if (income < 200000)cout <<”High”;else cout << “Very high”;***When income = 1000, cout << “Middle” + “Very high”switch (choice){case 1 :breakcase 2:case 4:break***Only can use integers, not strings in
View Full Document