class_notes12

class_notes12 - C Summary 3 Structured program development...

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

View Full Document Right Arrow Icon
Engineering 3 – Class 12 Today: type conversion final array example C summary MATLAB vs. C
Background image of page 1

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

View Full Document Right Arrow Icon
Remember the difference between integer and floating point division: int a = 7, b = 3; float c = 7.0, d = 3.0, result1, result2; result1 = a/b; result2 = d/e; Type Conversion Override using cast operator: result1 = (float)a/b; Example: grade.c
Background image of page 2
Type Conversion Remember the difference between integer and floating point division: int a=4, b=5, c=6, d=3; printf( “ %d\n” , a+c/b+d ); printf( “ %d\n” , a*c/b+d ); printf( “ %.2f\n” , (float)(a+d)/d ); printf( “ %.2f\n” , (float)( (a+d)/d)); 8 7 2.33 2.00
Background image of page 3

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

View Full Document Right Arrow Icon
2D Arrays Yet another grade example…. class.c
Background image of page 4
C Summary 1. Intro to computers and C programming good background info short answer, T/F questions 2. C basics variables types (eg. int, float, char) heirarchy arithmetic in C (order of operations) equality and relational operators, decision making
Background image of page 5

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

View Full Document Right Arrow Icon
Background image of page 6
Background image of page 7

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

View Full Document Right Arrow Icon
Background image of page 8
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: C Summary 3. Structured program development – algorithm design – if/else if/else statements, ternary operators – while loops – increment and decrement operators (++, --, +=, etc) 4. Program control (except 4.7) – repetition, counters vs. sentinels – for loops – do…while loops – break and continue statements – logical operators (&& and ||) C Summary 5. Functions (5.1-5.9) – built in functions – math library functions – writing and using custom functions – random number generation 6. Arrays (only linear search in 6.8) – declaring and initializing – manipulation (using for loops to traverse)_ – passing to functions – multi-dimensional (only 2D) onward to MatLab… • Compiled vs. Interpreted languages • Comparison-find sin(x) for in steps of 0.1-plot? π 2 ≤ ≤ x...
View Full Document

{[ snackBarMessage ]}

Page1 / 8

class_notes12 - C Summary 3 Structured program development...

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

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