tailieunhanh - Giáo trình tin học chương 2

Control Structures • Sequential execution – Statements executed in order • Transfer of control – Next statement executed not next one in sequence • 3 control structures (Bohm and Jacopini) – Sequence structure • Programs executed sequentially by default – Selection structures • if, if/else, switch – Repetition structures • while, do/while, for | 1 Chapter 2 - Control Structures Outline Control Structures if Selection Structure if else Selection Structure while Repetition Structure Formulating Algorithms Case Study 1 Counter-Controlled Repetition Formulating Algorithms with Top-Down Stepwise Refinement Case Study 2 Sentinel-Controlled Repetition Formulating Algorithms with Top-Down Stepwise Refinement Case Study 3 Nested Control Structures Assignment Operators Increment and Decrement Operators Essentials of Counter-Controlled Repetition for Repetition Structure switch Multiple-Selection Structure do while Repetition Structure break and continue Statements Logical Operators Confusing Equality and Assignment Operators Structured-Programming Summary 2003 Prentice Hall Inc. All rights reserved. 2 Control Structures Sequential execution - Statements executed in order Transfer of control - Next statement executed not next one in sequence 3 control structures Bohm and Jacopini - Sequence structure Programs executed sequentially by default - Selection structures if if else switch - Repetition structures while do while for 2003 Prentice Hall Inc. All rights reserved. 3 Control Structures C keywords - Cannot be used as identifiers or variable names C Keywords Keywords common to the C and C programming languages auto break case char const continue default do double else enum extern float for goto if int long register return short signed sizeof static struct switch typedef union unsigned void volatile while C only keywords asm bool catch class const_cast delete dynamic_cast explicit false friend inline mutable namespace new operator private protected public reinterpret_cast static_cast template this throw true try typeid typename using virtual wchart 2003 Prentice Hall Inc. All rights .

TỪ KHÓA LIÊN QUAN