day3.24cse110

# day3.24cse110 - Chapter 2 Data and Expressions From the...

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

Chapter 2 Data and Expressions

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

View Full Document
From the Last Lecture An expression is a combination of one or more operators and operands Arithmetic expressions compute numeric results and make use of the arithmetic operators: % has not been defined for double or floating point numbers Addition Subtraction Multiplication Division Remainder + - * / % Arithmetic Operators:
3 From the Last Lecture : Arithmetic Operators C++ Operators + addition - subtraction * multiplication / division % remainder (mod operator) +, -, *, and / can be used with integral and floating-point data types Binary Operator - has two operands Examples: 2 + 3 = 5 14 / 7 = 2 34 / 5 = 6 34 % 5 = 4 2.35 + 5 = 7.35 2 + 6 * 4 /2 = 14 3* (10/5 + 6) = ? 6 / 4 + 3.9 = ? 5.4 * 2 – 13.6 + 18 / 2 = ?

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

View Full Document
4 From the Last Lecture: Order of Precedence All operations inside of () are evaluated first * , / , and % are at the same level of precedence and are evaluated next + and have the same level of precedence and are evaluated last When operators are in the same level Performed from left to right
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 12/08/2010 for the course CSE 110 taught by Professor Kim during the Spring '08 term at ASU.

### Page1 / 17

day3.24cse110 - Chapter 2 Data and Expressions From the...

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

View Full Document
Ask a homework question - tutors are online