statements

statements - Preliminaries Expressions Statements Text File...

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

View Full Document Right Arrow Icon

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

View Full Document Right Arrow Icon

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

View Full Document Right Arrow Icon

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

View Full Document Right Arrow Icon

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

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

Unformatted text preview: Preliminaries Expressions Statements Text File Input/Output C ++ Expressions and Statements Len Blanks CSC 1253 Introduction To Computer Science I Using C ++ Louisiana State University September 22, 2010 Len Blanks C ++ Expressions and Statements Preliminaries Expressions Statements Text File Input/Output Topics 1 Preliminaries 2 Expressions Basic Expressions Basic Numeric Expressions Expressions with Side-Effects 3 Statements Declarations Expression Statements Compound Statements Conditional Statements Iterative Statements 4 Text File Input/Output Len Blanks C ++ Expressions and Statements Preliminaries Expressions Statements Text File Input/Output References The material for this lecture is heavily based on content from The C ++ Programming Language by Bjarne Stroustrup. Len Blanks C ++ Expressions and Statements Preliminaries Expressions Statements Text File Input/Output Basic Expressions Basic Numeric Expressions Expressions with Side-Effects Expressions All C ++ expressions have a value and a type; some, like assignment, pre- and post-increment and decrement and some function references, even have a side-effect. The simplest valid C ++ expression is formed with a single constant, a single variable, a single array reference, a single function reference (call) or a C ++ expression enclosed in parentheses. More complicated expressions can be formed by combining expressions using operators. Len Blanks C ++ Expressions and Statements Preliminaries Expressions Statements Text File Input/Output Basic Expressions Basic Numeric Expressions Expressions with Side-Effects Basic Expressions post-increment lvalue ++ post-decrement lvalue-- compile-time checked cast static cast< type >( expr ) pre-increment ++ lvalue pre-decrement-- lvalue logical NOT ! expr unary minus- expr unary plus + expr C style cast ( type ) expr multiply expr * expr divide expr / expr modulo expr % expr add expr + expr subtract expr- expr Len Blanks C ++ Expressions and Statements Preliminaries Expressions Statements Text File Input/Output Basic Expressions Basic Numeric Expressions Expressions with Side-Effects Basic Expressions less than expr < expr less than or equal expr <= expr greater than expr > expr greater than or equal expr >= expr equal expr == expr not equal expr != expr logical AND expr && expr logical OR expr || expr simple assignment lvalue = expr multiply and assign lvalue *= expr divide and assign lvalue /= expr modulo and assign lvalue %= expr add and assign lvalue += expr subtract and assign lvalue-= expr Len Blanks C ++ Expressions and Statements Preliminaries Expressions Statements Text File Input/Output Basic Expressions Basic Numeric Expressions Expressions with Side-Effects Basic Expressions conditional expression expr ? expr : expr throw exception throw expr comma (sequencing) expression expr , expr Each box holds operators with the same precedence, boxes ordered from highest to lowest precedence. a + b * c means a + (b * c) since * has higher precedence than...
View Full Document

{[ snackBarMessage ]}

Page1 / 45

statements - Preliminaries Expressions Statements Text File...

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