{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

June 23

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

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

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;

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

View Full Document
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”;
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}