day3.24cse110

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

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

View Full Document Right Arrow Icon
Chapter 2 Data and Expressions
Background image of page 1

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

View Full DocumentRight Arrow Icon
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:
Background image of page 2
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 = ?
Background image of page 3

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

View Full DocumentRight Arrow Icon
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
Background image of page 4
Image of page 5
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 Right Arrow Icon
Ask a homework question - tutors are online