cs16wk03c

# cs16wk03c - Operations depend on types Operations e.g...

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

Operations depend on types Operations depend on types e.g., binary operation: e.g., binary operation: a a op op b b z If a and b are same type: (1) perform op based on rules of that type, and (2) return result of that type z If a and b are different types: (0) make a copy of “lower” value promoted to “higher” type – Then (1), (2) as above using copy and higher type item – Means result is higher type (see high to low types on p. 44) z Cast operator – specifies type of copied value double d = 2.5; int n = 10 / (int)d; /* Q. What does n equal? */

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

View Full Document
Technique: linear interpolation Technique: linear interpolation z Text pp. 56-59 describes idea of “similar triangles” z Program chapter2_2 - applies it to seawater temperatures …demo03/ p2-2.c
Functions for characters Functions for characters z Alternatives to scanf , printf with "%c" : int c = getchar (); putchar (c); /* one character at a time */ z Ways to make a copy of a character: tolower (c) , toupper (c) z Ways to ask about a character’s kind: islower (c) , isupper (c) , isalpha (c) , isdigit (c) , isxdigit (c) , … Try it!

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 12

cs16wk03c - Operations depend on types Operations e.g...

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

View Full Document
Ask a homework question - tutors are online