June 23 - 1. In troduction of variables 2. Ch. 3 a. More...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
1. Introduction of variables 2. Ch. 3 a. More than linear instructions 3. Math Operations 4. Anatomy of a program a. Int main () return (0); [indicate libraries in head of program: iostream and math program and main space] b. Double x= 3.14159; c. Int y=10; d. Int z=3; e. X= x/y; f. Double #/ int # g. 10/3; h. x will end up as 3.0 i. X= double (y)/ double (z); 5. Use of decimals vs. Integers 6. Comparisons 7. = vs. == 8. hh and ll 9. if/ else if/else 10.Rounding: H.W a. double x= 3.14159; cout << fixed [ensures you don’t get scientific notation]<< setprecision (2) [limit output to 2 decimal places] << x;
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
b. double x= 3.14159; x = x*100; // 314.159 x= int (x); // 314 x= x/100; 3.14 x= (int(x*100))100; This rounds X= (int ((+.5) *100))/100; Math Operators: + (plus) - (minus) (times) /(division) % (modulus; returns the remainder of division) () control order of operations x= x+y*4; Conditional Branching Int temperature= 0; Cin>> temperature; If (temperature == 0) cout<< “Freezing point!”; If (temperature == 100) cout<< “Boiling Point”;
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 06/30/2010 for the course PSYCH 129B taught by Professor Kupper during the Spring '07 term at UCLA.

Page1 / 3

June 23 - 1. In troduction of variables 2. Ch. 3 a. More...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online