DOC PREVIEW
UCLA COMSCI 31 - CS lecture 3

This preview shows page 1 out of 3 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 3 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 3 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

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

UCLA COMSCI 31 - CS lecture 3

Download CS lecture 3
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view CS lecture 3 and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view CS lecture 3 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?