cps 196 week 4

Cps 196 week 4 - Integer and Floating point conversions int to float and float to int 55.0 5.19 5 type casting force an integer to be floating

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

View Full Document Right Arrow Icon
Integer and Floating point conversions int to float and float to int 5 5.0 5.19 5 type casting force an integer to be floating point number (and vice versa) change result to floating point variable force value 2 to be floating point, so result is floating point Assignment operator format: op= operator can be +,-,*,/, % count += 10; same as count = count+10; count -=5; count=count-5 a /=b+c a=a/ b+c a/= a/(b+c) use a lot (especially in loops) i++; i=i+1; i--; i=i-1; int i=1 Loop - some problems may require us to preform some routine/procedure over and over. 6x1=6 –-> Printf(“%i x 1 = %i\n”, value1, value1*1); 6x2= printf(%i x 2 = %i\n”, value1, value 1*2); 6x3= 6x4= 6x5= 6x6= 6x7= 6x8= 6x9== 6x10= 6x11= 6x12= 72
Background image of page 1

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

View Full DocumentRight Arrow Icon
^^^^^not efficient^^^^^ Loop statement 1 “for statement” for (initial expression; loop condition; loop experession) (NO SEMI COLON) { …loop body } o initial expression is used to set the initial values before the loop begins o
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 02/16/2012 for the course CPS 196 taught by Professor Staff during the Spring '08 term at Syracuse.

Page1 / 5

Cps 196 week 4 - Integer and Floating point conversions int to float and float to int 55.0 5.19 5 type casting force an integer to be floating

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