COM SCI 31 Lecture 5: wk 2 Lecture 5

17 views3 pages
19 Apr 2017
School

Document Summary

Declaration (creating new object that did(cid:374)"t e(cid:454)ist(cid:895) Assig(cid:374)(cid:373)e(cid:374)t state(cid:373)e(cid:374)t (cid:894)do(cid:374)"t (cid:374)eed a t(cid:455)pe; use (cid:449)hate(cid:448)er (cid:455)ou put i(cid:374) there(cid:895) Hard to find & change so give number a name int main() const double payrate_threshold = 12. 00; const double high_withholding_rate = 0. 10; const double low_withholding_rate = 0. 05; //solution if (cid:894)(cid:272)itize(cid:374)ship == (cid:862)u a(cid:863)(cid:895) if (age >= 18) else. //combined statement if (cid:894)(cid:272)itize(cid:374)ship == (cid:862)u a(cid:863) && age >= (cid:1005)8(cid:895) (cid:272)out << (cid:862)you (cid:272)a(cid:374) (cid:448)ote i(cid:374) u ele(cid:272)tio(cid:374)s(cid:863) << e(cid:374)dl; it"s o(cid:374)l(cid:455) true if both are true. If o(cid:374)e"s false, does(cid:374)"t (cid:271)other to (cid:272)he(cid:272)k the other o(cid:374)e. // (cid:862)or(cid:863) state(cid:373)e(cid:374)t if (cid:894)(cid:272)itize(cid:374)ship = (cid:862)u a(cid:863) || (cid:272)itize(cid:374)ship == (cid:862)ca(cid:374)ada(cid:863)(cid:895) (cid:272)out << (cid:862)the (cid:272)ou(cid:374)tr(cid:455) (cid:272)ode is (cid:1005)(cid:863) << e(cid:374)dl; Not (a or b) ==> (not a) and (not b) Not (a and b) ==> (not a) or (not b) Not (a < b) ==> a >= b. Not (a <= b) ==> a > b. Not (a > b) ==> a <= b.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents