SlideShare una empresa de Scribd logo
1 de 116
 
Chapter 3 More Flow of Control
Overview ,[object Object],[object Object],[object Object],[object Object],Slide 3-
Flow Of Control ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Slide 3-
3.1 Using Boolean Expressions
Using Boolean Expressions ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Slide 3-
Evaluating Boolean Expressions ,[object Object],[object Object],Slide 3-  Display 3.1 ! (  false  | |  true  ) ! (  true  ) false
Order of Precedence ,[object Object],[object Object],[object Object],[object Object],[object Object],Slide 3-
Precedence Rules ,[object Object],[object Object],[object Object],[object Object],Slide 3-  Display 3.2
Precedence Rule Example ,[object Object],[object Object],[object Object],Slide 3-
Evaluating  x + 1 > 2 | | x + 1 < - 3 ,[object Object],[object Object],[object Object],[object Object],[object Object],Slide 3-
Short-Circuit Evaluation ,[object Object],[object Object],[object Object],[object Object],Slide 3-
Using Short-Circuit Evaluation ,[object Object],[object Object],[object Object],[object Object],Slide 3-
Type bool and Type int ,[object Object],[object Object],[object Object],Slide 3-
Problems with ! ,[object Object],[object Object],[object Object],[object Object],[object Object],Slide 3-
Correcting the ! Problem ,[object Object],Slide 3-
Avoiding ! ,[object Object],[object Object],Slide 3-
Enumeration Types (Optional) ,[object Object],[object Object],[object Object],Slide 3-
Default enum Values ,[object Object],[object Object],Slide 3-
Enumeration Values ,[object Object],[object Object],[object Object],Slide 3-
Section 3.1 Conclusion ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Slide 3-
3.2 Multiway Branches
Multiway Branches ,[object Object],[object Object],[object Object],[object Object],Slide 3-
Nested Statements ,[object Object],[object Object],[object Object],Slide 3-  indented Display 3.3
Nested if-else Statements ,[object Object],[object Object],Slide 3-
First Try  Nested if's ,[object Object],[object Object],[object Object],Slide 3-
Braces and Nested Statements ,[object Object],[object Object],[object Object],[object Object],Slide 3-  Display 3.4
Multi-way if-else-statements ,[object Object],[object Object],[object Object],Slide 3-
Number Guessing  ,[object Object],[object Object],Slide 3-
Indenting Nested if-else ,[object Object],[object Object],Slide 3-
The Final if-else-statement ,[object Object],[object Object],[object Object],Slide 3-
Nested if-else Syntax ,[object Object],[object Object],Slide 3-
Program Example: State Income Tax ,[object Object],Slide 3-  Display 3.5 (1) Display 3.5 (2)
Refining if-else-statements ,[object Object],[object Object],Slide 3-
The switch-statement ,[object Object],[object Object],[object Object],[object Object],[object Object],Slide 3-  Display 3.6 (1) Display 3.6 (2)
switch-statement Syntax ,[object Object],Slide 3-
The Controlling Statement ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Slide 3-
The break Statement ,[object Object],[object Object],[object Object],[object Object],[object Object],Slide 3-
The default Statement ,[object Object],[object Object],[object Object],Slide 3-
Switch-statements and Menus ,[object Object],[object Object],[object Object],Slide 3-  Display 3.7 (1) Display 3.7 (2)
Function Calls in Branches ,[object Object],[object Object],[object Object],Slide 3-
Blocks ,[object Object],[object Object],[object Object],[object Object],[object Object],Slide 3-  Display 3.8 (1) Display 3.8 (2)
Statement Blocks ,[object Object],[object Object],[object Object],[object Object],Slide 3-
Scope Rule for Nested Blocks ,[object Object],[object Object],[object Object],Slide 3-
Section 3.2 Conclusion ,[object Object],[object Object],Slide 3-
3.3 More About C++ Loop Statements
More About  C++ Loop Statements ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Slide 3-
while and do-while ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Slide 3-  Display 3.9
The Increment Operator ,[object Object],[object Object],[object Object],Slide 3-
number++ vs ++number ,[object Object],[object Object],[object Object],[object Object],[object Object],Slide 3-
++ Comparisons ,[object Object],[object Object],Slide 3-  Display 3.10
The Decrement Operator ,[object Object],[object Object],[object Object],Slide 3-
The for-Statement ,[object Object],[object Object],[object Object],[object Object],Slide 3-
for/while Loop Comparison ,[object Object],[object Object],Slide 3-
For Loop Dissection ,[object Object],[object Object],Slide 3-  Initialization Action Boolean Expression Update Action
for Loop Alternative ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Slide 3-  Display 3.11
for-loop Details ,[object Object],[object Object],[object Object],[object Object],Slide 3-
The for-loop Body ,[object Object],[object Object],[object Object],[object Object],[object Object],Slide 3-  Display 3.13
The Empty Statement ,[object Object],[object Object],[object Object],Slide 3-
Extra Semicolon ,[object Object],[object Object],[object Object],[object Object],Slide 3-
Local Variable Standard ,[object Object],[object Object],[object Object],Slide 3-
Which Loop To Use? ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Slide 3-
Choosing a for-loop ,[object Object],Slide 3-
Choosing a while-loop ,[object Object],[object Object],[object Object],Slide 3-
Choosing a do-while Loop ,[object Object],[object Object],[object Object],Slide 3-
The break-Statement ,[object Object],[object Object],[object Object],[object Object],Slide 3-  Display 3.14
Section 3.3 Conclusion ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Slide 3-
3.4 Designing Loops
Designing Loops ,[object Object],[object Object],[object Object],[object Object],Slide 3-
Sums and Products ,[object Object],[object Object],[object Object],Slide 3-
for-loop for a sum ,[object Object],[object Object],Slide 3-
Repeat &quot;this many times&quot; ,[object Object],[object Object],[object Object],Slide 3-
for-loop For a Product ,[object Object],[object Object],[object Object],Slide 3-
Ending a Loop ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Slide 3-
List Headed By Size ,[object Object],[object Object],Slide 3-
Ask Before Iterating ,[object Object],Slide 3-
List Ended With a Sentinel Value ,[object Object],[object Object],Slide 3-
Running Out of Input ,[object Object],Slide 3-
General Methods To Control Loops ,[object Object],[object Object],[object Object],[object Object],Slide 3-
Count Controlled Loops ,[object Object],[object Object],Slide 3-
Exit on Flag Condition ,[object Object],[object Object],[object Object],[object Object],[object Object],Slide 3-
Exit on Flag Caution ,[object Object],Slide 3-
The Problem ,[object Object],[object Object],[object Object],Slide 3-
The Exit On Flag Solution ,[object Object],Slide 3-
Nested Loops ,[object Object],[object Object],[object Object],[object Object],Slide 3-  Display 3.15
Debugging Loops ,[object Object],[object Object],[object Object],Slide 3-
Fixing Off By One Errors ,[object Object],[object Object],[object Object],Slide 3-
Fixing Infinite Loops ,[object Object],[object Object],[object Object],Slide 3-
More  Loop Debugging Tips ,[object Object],[object Object],[object Object],[object Object],[object Object],Slide 3-
Debugging Example ,[object Object],Slide 3-
Tracing Variables ,[object Object],Slide 3-
First Fix ,[object Object],[object Object],[object Object],Slide 3-
Second Fix ,[object Object],[object Object],Slide 3-
Loop Testing Guidelines ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Slide 3-
Starting Over ,[object Object],[object Object],[object Object],[object Object],[object Object],Slide 3-
Chapter 3.4 Conclusion ,[object Object],[object Object],[object Object],[object Object],Slide 3-
Chapter 3 -- End Slide 3-
Display 3.1  Slide 3-  Back Next
Display 3.2 Slide 3-  Back Next
Display 3.3 Slide 3-  Back Next
Display 3.4 Slide 3-  Back Next
Display 3.5 (1/2) Slide 3-  Back Next
Display 3.5 (2/2) Slide 3-  Back Next
Display 3.6  (1/2) Slide 3-  Back Next
Display 3.6  (2/2) Slide 3-  Back Next
Display 3.7  (1/2) Slide 3-  Back Next
Display 3.7  (2/2) Slide 3-  Back Next
Display 3.8  (1/2) Slide 3-  Next Back
Display 3.8  (2/2) Slide 3-  Back Next
Display 3.9 Slide 3-  Back Next
Display 3.10 Slide 3-  Next Back
Display 3.11 Slide 3-  Back Next
Display 3.12 Slide 3-  Back Next
Display 3.13 Slide 3-  Back Next
Display 3.14 Slide 3-  Back Next
Display 3.15 Slide 3-  Next Back

Más contenido relacionado

La actualidad más candente

Numerical approximation
Numerical approximationNumerical approximation
Numerical approximation
Mileacre
 
Applications of boolean algebra minterm and maxterm expansions
Applications of boolean algebra minterm and maxterm expansionsApplications of boolean algebra minterm and maxterm expansions
Applications of boolean algebra minterm and maxterm expansions
kanyuma jitjumnong
 

La actualidad más candente (20)

Numerical approximation
Numerical approximationNumerical approximation
Numerical approximation
 
Line Search Techniques by Fibonacci Search
Line Search Techniques by Fibonacci SearchLine Search Techniques by Fibonacci Search
Line Search Techniques by Fibonacci Search
 
Math 7 inequalities and intervals
Math 7   inequalities and intervalsMath 7   inequalities and intervals
Math 7 inequalities and intervals
 
Bisection Method
Bisection Method Bisection Method
Bisection Method
 
Lar calc10 ch03_sec3
Lar calc10 ch03_sec3Lar calc10 ch03_sec3
Lar calc10 ch03_sec3
 
Chapter 3 branching v4
Chapter 3 branching v4Chapter 3 branching v4
Chapter 3 branching v4
 
Lar calc10 ch01_sec3
Lar calc10 ch01_sec3Lar calc10 ch01_sec3
Lar calc10 ch01_sec3
 
Matlab intro notes
Matlab intro notesMatlab intro notes
Matlab intro notes
 
[ITP - Lecture 09] Conditional Operator in C/C++
[ITP - Lecture 09] Conditional Operator in C/C++[ITP - Lecture 09] Conditional Operator in C/C++
[ITP - Lecture 09] Conditional Operator in C/C++
 
Boolean algebra
Boolean algebraBoolean algebra
Boolean algebra
 
Assignment Poblems
Assignment Poblems Assignment Poblems
Assignment Poblems
 
Assignment Chapter - Q & A Compilation by Niraj Thapa
Assignment Chapter  - Q & A Compilation by Niraj ThapaAssignment Chapter  - Q & A Compilation by Niraj Thapa
Assignment Chapter - Q & A Compilation by Niraj Thapa
 
Quantitative Math
Quantitative MathQuantitative Math
Quantitative Math
 
[ITP - Lecture 06] Operators, Arithmetic Expression and Order of Precedence
[ITP - Lecture 06] Operators, Arithmetic Expression and Order of Precedence[ITP - Lecture 06] Operators, Arithmetic Expression and Order of Precedence
[ITP - Lecture 06] Operators, Arithmetic Expression and Order of Precedence
 
Applications of boolean algebra minterm and maxterm expansions
Applications of boolean algebra minterm and maxterm expansionsApplications of boolean algebra minterm and maxterm expansions
Applications of boolean algebra minterm and maxterm expansions
 
Boolean variables r010
Boolean variables   r010Boolean variables   r010
Boolean variables r010
 
Stewart calc7e 01_08
Stewart calc7e 01_08Stewart calc7e 01_08
Stewart calc7e 01_08
 
Lar calc10 ch01_sec4
Lar calc10 ch01_sec4Lar calc10 ch01_sec4
Lar calc10 ch01_sec4
 
AMA_Assignment Theory notes
AMA_Assignment Theory notesAMA_Assignment Theory notes
AMA_Assignment Theory notes
 
C Sharp Jn (2)
C Sharp Jn (2)C Sharp Jn (2)
C Sharp Jn (2)
 

Similar a Savitch ch 03

Java căn bản - Chapter6
Java căn bản - Chapter6Java căn bản - Chapter6
Java căn bản - Chapter6
Vince Vo
 
[C++][a] tutorial 2
[C++][a] tutorial 2[C++][a] tutorial 2
[C++][a] tutorial 2
yasir_cesc
 
Java căn bản - Chapter5
Java căn bản - Chapter5Java căn bản - Chapter5
Java căn bản - Chapter5
Vince Vo
 
C programming session 02
C programming session 02C programming session 02
C programming session 02
Dushmanta Nath
 

Similar a Savitch ch 03 (20)

Savitch Ch 03
Savitch Ch 03Savitch Ch 03
Savitch Ch 03
 
Control All
Control AllControl All
Control All
 
Conditional Statements
Conditional StatementsConditional Statements
Conditional Statements
 
Lecture 3
Lecture 3Lecture 3
Lecture 3
 
Savitch_ch_03.ppt
Savitch_ch_03.pptSavitch_ch_03.ppt
Savitch_ch_03.ppt
 
Java căn bản - Chapter6
Java căn bản - Chapter6Java căn bản - Chapter6
Java căn bản - Chapter6
 
Code Tuning
Code TuningCode Tuning
Code Tuning
 
[C++][a] tutorial 2
[C++][a] tutorial 2[C++][a] tutorial 2
[C++][a] tutorial 2
 
Java căn bản - Chapter5
Java căn bản - Chapter5Java căn bản - Chapter5
Java căn bản - Chapter5
 
Ecs 10 programming assignment 4 loopapalooza
Ecs 10 programming assignment 4   loopapaloozaEcs 10 programming assignment 4   loopapalooza
Ecs 10 programming assignment 4 loopapalooza
 
Algorithm and flowchart
Algorithm and flowchartAlgorithm and flowchart
Algorithm and flowchart
 
C programming session 02
C programming session 02C programming session 02
C programming session 02
 
C Programing Arithmetic Operators.ppt
C Programing Arithmetic Operators.pptC Programing Arithmetic Operators.ppt
C Programing Arithmetic Operators.ppt
 
C++ programming
C++ programmingC++ programming
C++ programming
 
UNIT 1.pptx
UNIT 1.pptxUNIT 1.pptx
UNIT 1.pptx
 
Vb.Net 01 To 03 Summary Upload
Vb.Net 01 To 03 Summary UploadVb.Net 01 To 03 Summary Upload
Vb.Net 01 To 03 Summary Upload
 
Python unit 2 M.sc cs
Python unit 2 M.sc csPython unit 2 M.sc cs
Python unit 2 M.sc cs
 
Pseudocode
PseudocodePseudocode
Pseudocode
 
Daa unit 1
Daa unit 1Daa unit 1
Daa unit 1
 
Control statments in c
Control statments in cControl statments in c
Control statments in c
 

Más de Terry Yoast

Más de Terry Yoast (20)

9781305078444 ppt ch12
9781305078444 ppt ch129781305078444 ppt ch12
9781305078444 ppt ch12
 
9781305078444 ppt ch11
9781305078444 ppt ch119781305078444 ppt ch11
9781305078444 ppt ch11
 
9781305078444 ppt ch10
9781305078444 ppt ch109781305078444 ppt ch10
9781305078444 ppt ch10
 
9781305078444 ppt ch09
9781305078444 ppt ch099781305078444 ppt ch09
9781305078444 ppt ch09
 
9781305078444 ppt ch08
9781305078444 ppt ch089781305078444 ppt ch08
9781305078444 ppt ch08
 
9781305078444 ppt ch07
9781305078444 ppt ch079781305078444 ppt ch07
9781305078444 ppt ch07
 
9781305078444 ppt ch06
9781305078444 ppt ch069781305078444 ppt ch06
9781305078444 ppt ch06
 
9781305078444 ppt ch05
9781305078444 ppt ch059781305078444 ppt ch05
9781305078444 ppt ch05
 
9781305078444 ppt ch04
9781305078444 ppt ch049781305078444 ppt ch04
9781305078444 ppt ch04
 
9781305078444 ppt ch03
9781305078444 ppt ch039781305078444 ppt ch03
9781305078444 ppt ch03
 
9781305078444 ppt ch02
9781305078444 ppt ch029781305078444 ppt ch02
9781305078444 ppt ch02
 
9781305078444 ppt ch01
9781305078444 ppt ch019781305078444 ppt ch01
9781305078444 ppt ch01
 
9781337102087 ppt ch13
9781337102087 ppt ch139781337102087 ppt ch13
9781337102087 ppt ch13
 
9781337102087 ppt ch18
9781337102087 ppt ch189781337102087 ppt ch18
9781337102087 ppt ch18
 
9781337102087 ppt ch17
9781337102087 ppt ch179781337102087 ppt ch17
9781337102087 ppt ch17
 
9781337102087 ppt ch16
9781337102087 ppt ch169781337102087 ppt ch16
9781337102087 ppt ch16
 
9781337102087 ppt ch15
9781337102087 ppt ch159781337102087 ppt ch15
9781337102087 ppt ch15
 
9781337102087 ppt ch14
9781337102087 ppt ch149781337102087 ppt ch14
9781337102087 ppt ch14
 
9781337102087 ppt ch12
9781337102087 ppt ch129781337102087 ppt ch12
9781337102087 ppt ch12
 
9781337102087 ppt ch11
9781337102087 ppt ch119781337102087 ppt ch11
9781337102087 ppt ch11
 

Último

Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 

Último (20)

microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
PROCESS RECORDING FORMAT.docx
PROCESS      RECORDING        FORMAT.docxPROCESS      RECORDING        FORMAT.docx
PROCESS RECORDING FORMAT.docx
 
Magic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptxMagic bus Group work1and 2 (Team 3).pptx
Magic bus Group work1and 2 (Team 3).pptx
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Third Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxThird Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptx
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...Making communications land - Are they received and understood as intended? we...
Making communications land - Are they received and understood as intended? we...
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdfUGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
UGC NET Paper 1 Mathematical Reasoning & Aptitude.pdf
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 

Savitch ch 03