Presentation is loading. Please wait.

Presentation is loading. Please wait.

Expressions and statements Applications of Computer Programming in Earth Sciences Instructor: Dr. Cheng-Chien LiuCheng-Chien Liu Department of Earth Sciences.

Similar presentations


Presentation on theme: "Expressions and statements Applications of Computer Programming in Earth Sciences Instructor: Dr. Cheng-Chien LiuCheng-Chien Liu Department of Earth Sciences."— Presentation transcript:

1 Expressions and statements Applications of Computer Programming in Earth Sciences Instructor: Dr. Cheng-Chien LiuCheng-Chien Liu Department of Earth Sciences National Cheng Kung University Last updated: 5 October 2004 Chapter 4

2 Definition  Statement End with a semicolon Whitespace Block and compound statement  Block itself doesn’t end with a semicolon  Expression Return a value

3 Operators  Two categories Assignment == Mathematical  +, - *, /, % Ex4-2 Division and modulus Modify Ex4-2  Combination of two categories Increment and decrement Prefix and postfix Ex4-3 Precedence and nesting parentheses

4 The nature of truth  Relational operator Table 4.1  False: 0  True: others (1)

5 Logical statement  if Single statement Block statement Indentation style Ex4-4  else Ex4-5  Nested statement of if and else Using braces  EX4-7, Ex4-8

6 Logical operators  Table 4.2  Precedence  Truth and falsehood  Conditional (ternary) operator ? : Ex4-9

7 Practice  Write a program to solve the quadratic equation


Download ppt "Expressions and statements Applications of Computer Programming in Earth Sciences Instructor: Dr. Cheng-Chien LiuCheng-Chien Liu Department of Earth Sciences."

Similar presentations


Ads by Google