SlideShare a Scribd company logo
1 of 18
Presented by:
Anil pokhrel
1
 Flow of control
 Statement
 Selection /decision
 Iteration/loop
 Jump statements
2
 The flow of control jumps from one part of
the program to another, depending on
calculations performed in the program
 Program statements that cause such jumps
are called control statements. There are
two major categories: loops and decisions
3
4
 Statements are the instructions given to
the computer to perform any kind of
action , be it data movements, be it
making decisions or be it repeating actions.
 Statements are the smallest executing unit
of a C++ program.
5
 A compound statement in C++ is a sequence
of statements enclosed by a pair of
branches { }.
{
statements 1 ;
statements 2 ;
: }
represents a compound statement
6
 The selection construct means the execution
of statements depending upon a condition
evaluates true, a set of statements is
followed.
7
8
 Also known as either or. This statement is
used to select one statement and ignore the
other statements.
if(condition)
s1;
else
s2;
when the condition is true statement
s1 is executed. If the condition is false s2 is
executed. Thus one of the statements, either s1
or s2 is always executed
9
 It is a multi branch statement which can be used
to select and execute one of the available
statements.
switch(value)
{
case 1: statement 1;
break;
case 2: statement 2;
break;
case n: statement n;
break;
default: statement d;
}
10
 Loops cause a section of your program to be
repeated a certain number of times.
 When the condition becomes false, the loop
ends and control passes to the statements
following the loop
11
 for
Natural "counting" loop
 do-while
Least flexible Always executes loop body
at least on
 while
Most flexible No “restrictions
12
 It is a repeated structure which can repeat a
statement as long as the given condition is
satisfied.
for(statement1; condition; statement2)
statement3;
13
While loop
while(condition)
statement1;
Do while loop
do
{
statement1;
}
while(condition);
14
 The types of jump statement are:
1)Break
2)Continue
3)Goto
4)Exit
5)Return
15
1)cpluspluslearner.blogspot.com/2012/05/cont
rol-statements-in-c.htm
2)https://www.cs.bu.edu/teaching/cs111/spri
ng-2000/control-flow/
16
17
18

More Related Content

What's hot

11303 dbms chap_02_triggers (2)
11303 dbms chap_02_triggers (2)11303 dbms chap_02_triggers (2)
11303 dbms chap_02_triggers (2)Simarjit Mann
 
Transaction states and properties
Transaction states and propertiesTransaction states and properties
Transaction states and propertiesChetan Mahawar
 
Python Programming - Control Flow
Python Programming - Control Flow Python Programming - Control Flow
Python Programming - Control Flow Omid AmirGhiasvand
 
Fundamentals of Software Engineering
Fundamentals of Software Engineering Fundamentals of Software Engineering
Fundamentals of Software Engineering Madhar Khan Pathan
 
Introduction to database-Transaction Concurrency and Recovery
Introduction to database-Transaction Concurrency and RecoveryIntroduction to database-Transaction Concurrency and Recovery
Introduction to database-Transaction Concurrency and RecoveryAjit Nayak
 
Transaction management
Transaction managementTransaction management
Transaction managementrenuka_a
 
Slide 6 Activity Diagram
Slide 6 Activity DiagramSlide 6 Activity Diagram
Slide 6 Activity DiagramNiloy Rocker
 

What's hot (12)

11303 dbms chap_02_triggers (2)
11303 dbms chap_02_triggers (2)11303 dbms chap_02_triggers (2)
11303 dbms chap_02_triggers (2)
 
States machine
States machineStates machine
States machine
 
serializability in dbms
serializability in dbmsserializability in dbms
serializability in dbms
 
Transaction states and properties
Transaction states and propertiesTransaction states and properties
Transaction states and properties
 
Chapter17
Chapter17Chapter17
Chapter17
 
Transactions
TransactionsTransactions
Transactions
 
Python Programming - Control Flow
Python Programming - Control Flow Python Programming - Control Flow
Python Programming - Control Flow
 
Fundamentals of Software Engineering
Fundamentals of Software Engineering Fundamentals of Software Engineering
Fundamentals of Software Engineering
 
Introduction to database-Transaction Concurrency and Recovery
Introduction to database-Transaction Concurrency and RecoveryIntroduction to database-Transaction Concurrency and Recovery
Introduction to database-Transaction Concurrency and Recovery
 
Transaction management
Transaction managementTransaction management
Transaction management
 
Process synchronization
Process synchronizationProcess synchronization
Process synchronization
 
Slide 6 Activity Diagram
Slide 6 Activity DiagramSlide 6 Activity Diagram
Slide 6 Activity Diagram
 

Similar to Control statement

2. Control structures with for while and do while.ppt
2. Control structures with for while and do while.ppt2. Control structures with for while and do while.ppt
2. Control structures with for while and do while.pptManojKhadilkar1
 
Programming Fundamentals in C++ structures
Programming Fundamentals in  C++ structuresProgramming Fundamentals in  C++ structures
Programming Fundamentals in C++ structuresayshasafdarwaada
 
Chapter 9 - Loops in C++
Chapter 9 - Loops in C++Chapter 9 - Loops in C++
Chapter 9 - Loops in C++Deepak Singh
 
Decision Making Statement in C ppt
Decision Making Statement in C pptDecision Making Statement in C ppt
Decision Making Statement in C pptMANJUTRIPATHI7
 
2nd year computer science chapter 12 notes
2nd year computer science chapter 12 notes2nd year computer science chapter 12 notes
2nd year computer science chapter 12 notesmuhammadFaheem656405
 
Conditional Statement both conditional and loop.pptx
Conditional Statement both conditional and loop.pptxConditional Statement both conditional and loop.pptx
Conditional Statement both conditional and loop.pptxZenith SVG
 
Chapter 3 - Flow of Control Part II.pdf
Chapter 3  - Flow of Control Part II.pdfChapter 3  - Flow of Control Part II.pdf
Chapter 3 - Flow of Control Part II.pdfKirubelWondwoson1
 
What is loops? What is For loop?
What is loops? What is For loop?What is loops? What is For loop?
What is loops? What is For loop?AnuragSrivastava272
 
Introduction to computer programming (C)-CSC1205_Lec5_Flow control
Introduction to computer programming (C)-CSC1205_Lec5_Flow controlIntroduction to computer programming (C)-CSC1205_Lec5_Flow control
Introduction to computer programming (C)-CSC1205_Lec5_Flow controlENGWAU TONNY
 
Control Statement IN C.pptx
Control Statement IN C.pptxControl Statement IN C.pptx
Control Statement IN C.pptxsujatha629799
 
Looping statements
Looping statementsLooping statements
Looping statementsJaya Kumari
 
Chapter 2 - Flow of Control Part I.pdf
Chapter 2 -  Flow of Control Part I.pdfChapter 2 -  Flow of Control Part I.pdf
Chapter 2 - Flow of Control Part I.pdfKirubelWondwoson1
 
Types of loops in c language
Types of loops in c languageTypes of loops in c language
Types of loops in c languagesneha2494
 

Similar to Control statement (20)

2. Control structures with for while and do while.ppt
2. Control structures with for while and do while.ppt2. Control structures with for while and do while.ppt
2. Control structures with for while and do while.ppt
 
Programming Fundamentals in C++ structures
Programming Fundamentals in  C++ structuresProgramming Fundamentals in  C++ structures
Programming Fundamentals in C++ structures
 
Comp ppt (1)
Comp ppt (1)Comp ppt (1)
Comp ppt (1)
 
Chapter 9 - Loops in C++
Chapter 9 - Loops in C++Chapter 9 - Loops in C++
Chapter 9 - Loops in C++
 
Controls & Loops in C
Controls & Loops in C Controls & Loops in C
Controls & Loops in C
 
C sharp chap4
C sharp chap4C sharp chap4
C sharp chap4
 
Decision Making Statement in C ppt
Decision Making Statement in C pptDecision Making Statement in C ppt
Decision Making Statement in C ppt
 
Control statements
Control statementsControl statements
Control statements
 
2nd year computer science chapter 12 notes
2nd year computer science chapter 12 notes2nd year computer science chapter 12 notes
2nd year computer science chapter 12 notes
 
Conditional Statement both conditional and loop.pptx
Conditional Statement both conditional and loop.pptxConditional Statement both conditional and loop.pptx
Conditional Statement both conditional and loop.pptx
 
C++ chapter 4
C++ chapter 4C++ chapter 4
C++ chapter 4
 
Chapter 3 - Flow of Control Part II.pdf
Chapter 3  - Flow of Control Part II.pdfChapter 3  - Flow of Control Part II.pdf
Chapter 3 - Flow of Control Part II.pdf
 
What is loops? What is For loop?
What is loops? What is For loop?What is loops? What is For loop?
What is loops? What is For loop?
 
Introduction to computer programming (C)-CSC1205_Lec5_Flow control
Introduction to computer programming (C)-CSC1205_Lec5_Flow controlIntroduction to computer programming (C)-CSC1205_Lec5_Flow control
Introduction to computer programming (C)-CSC1205_Lec5_Flow control
 
Control Statement IN C.pptx
Control Statement IN C.pptxControl Statement IN C.pptx
Control Statement IN C.pptx
 
C language 2
C language 2C language 2
C language 2
 
Looping statements
Looping statementsLooping statements
Looping statements
 
Chapter 2 - Flow of Control Part I.pdf
Chapter 2 -  Flow of Control Part I.pdfChapter 2 -  Flow of Control Part I.pdf
Chapter 2 - Flow of Control Part I.pdf
 
Control statements in java
Control statements in javaControl statements in java
Control statements in java
 
Types of loops in c language
Types of loops in c languageTypes of loops in c language
Types of loops in c language
 

More from Anil Pokhrel

Internet and intranet
Internet and intranetInternet and intranet
Internet and intranetAnil Pokhrel
 
Measure of dispersion
Measure of dispersionMeasure of dispersion
Measure of dispersionAnil Pokhrel
 
Correlation and regression
Correlation and regressionCorrelation and regression
Correlation and regressionAnil Pokhrel
 
Correlation analysis
Correlation analysis Correlation analysis
Correlation analysis Anil Pokhrel
 
Function in C Programming
Function in C ProgrammingFunction in C Programming
Function in C ProgrammingAnil Pokhrel
 
2 dimension array in programms
2 dimension array in programms2 dimension array in programms
2 dimension array in programmsAnil Pokhrel
 
Priority scheuling
Priority scheuling Priority scheuling
Priority scheuling Anil Pokhrel
 
Operating system file system
Operating system file systemOperating system file system
Operating system file systemAnil Pokhrel
 
object oriented programming OOP
object oriented programming OOPobject oriented programming OOP
object oriented programming OOPAnil Pokhrel
 
Numerical method runge kutta method
Numerical method runge kutta methodNumerical method runge kutta method
Numerical method runge kutta methodAnil Pokhrel
 
Management profile ppt
Management profile pptManagement profile ppt
Management profile pptAnil Pokhrel
 
Bus and memory transfer
Bus and memory transferBus and memory transfer
Bus and memory transferAnil Pokhrel
 
Computer architecture data representation
Computer architecture  data representationComputer architecture  data representation
Computer architecture data representationAnil Pokhrel
 
Management and leadership skills
Management and leadership skillsManagement and leadership skills
Management and leadership skillsAnil Pokhrel
 
color detection using open cv
color detection using open cvcolor detection using open cv
color detection using open cvAnil Pokhrel
 
Client-server technology in web design
Client-server technology in web designClient-server technology in web design
Client-server technology in web designAnil Pokhrel
 
Software Engineering requirements
Software Engineering requirementsSoftware Engineering requirements
Software Engineering requirementsAnil Pokhrel
 
I WAY (SUPER HIGHWAY INFORMATION)
I WAY (SUPER HIGHWAY INFORMATION)I WAY (SUPER HIGHWAY INFORMATION)
I WAY (SUPER HIGHWAY INFORMATION)Anil Pokhrel
 

More from Anil Pokhrel (20)

System software
System softwareSystem software
System software
 
Internet and intranet
Internet and intranetInternet and intranet
Internet and intranet
 
Measure of dispersion
Measure of dispersionMeasure of dispersion
Measure of dispersion
 
Correlation and regression
Correlation and regressionCorrelation and regression
Correlation and regression
 
Correlation analysis
Correlation analysis Correlation analysis
Correlation analysis
 
Function in C Programming
Function in C ProgrammingFunction in C Programming
Function in C Programming
 
2 dimension array in programms
2 dimension array in programms2 dimension array in programms
2 dimension array in programms
 
Priority scheuling
Priority scheuling Priority scheuling
Priority scheuling
 
Operating system file system
Operating system file systemOperating system file system
Operating system file system
 
object oriented programming OOP
object oriented programming OOPobject oriented programming OOP
object oriented programming OOP
 
Numerical method runge kutta method
Numerical method runge kutta methodNumerical method runge kutta method
Numerical method runge kutta method
 
Management profile ppt
Management profile pptManagement profile ppt
Management profile ppt
 
Impact of error
Impact of errorImpact of error
Impact of error
 
Bus and memory transfer
Bus and memory transferBus and memory transfer
Bus and memory transfer
 
Computer architecture data representation
Computer architecture  data representationComputer architecture  data representation
Computer architecture data representation
 
Management and leadership skills
Management and leadership skillsManagement and leadership skills
Management and leadership skills
 
color detection using open cv
color detection using open cvcolor detection using open cv
color detection using open cv
 
Client-server technology in web design
Client-server technology in web designClient-server technology in web design
Client-server technology in web design
 
Software Engineering requirements
Software Engineering requirementsSoftware Engineering requirements
Software Engineering requirements
 
I WAY (SUPER HIGHWAY INFORMATION)
I WAY (SUPER HIGHWAY INFORMATION)I WAY (SUPER HIGHWAY INFORMATION)
I WAY (SUPER HIGHWAY INFORMATION)
 

Recently uploaded

Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitecturePixlogix Infotech
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Alan Dix
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhisoniya singh
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024BookNet Canada
 

Recently uploaded (20)

Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
Understanding the Laravel MVC Architecture
Understanding the Laravel MVC ArchitectureUnderstanding the Laravel MVC Architecture
Understanding the Laravel MVC Architecture
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...Swan(sea) Song – personal research during my six years at Swansea ... and bey...
Swan(sea) Song – personal research during my six years at Swansea ... and bey...
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | DelhiFULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
FULL ENJOY 🔝 8264348440 🔝 Call Girls in Diplomatic Enclave | Delhi
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
New from BookNet Canada for 2024: BNC BiblioShare - Tech Forum 2024
 

Control statement

  • 2.  Flow of control  Statement  Selection /decision  Iteration/loop  Jump statements 2
  • 3.  The flow of control jumps from one part of the program to another, depending on calculations performed in the program  Program statements that cause such jumps are called control statements. There are two major categories: loops and decisions 3
  • 4. 4
  • 5.  Statements are the instructions given to the computer to perform any kind of action , be it data movements, be it making decisions or be it repeating actions.  Statements are the smallest executing unit of a C++ program. 5
  • 6.  A compound statement in C++ is a sequence of statements enclosed by a pair of branches { }. { statements 1 ; statements 2 ; : } represents a compound statement 6
  • 7.  The selection construct means the execution of statements depending upon a condition evaluates true, a set of statements is followed. 7
  • 8. 8
  • 9.  Also known as either or. This statement is used to select one statement and ignore the other statements. if(condition) s1; else s2; when the condition is true statement s1 is executed. If the condition is false s2 is executed. Thus one of the statements, either s1 or s2 is always executed 9
  • 10.  It is a multi branch statement which can be used to select and execute one of the available statements. switch(value) { case 1: statement 1; break; case 2: statement 2; break; case n: statement n; break; default: statement d; } 10
  • 11.  Loops cause a section of your program to be repeated a certain number of times.  When the condition becomes false, the loop ends and control passes to the statements following the loop 11
  • 12.  for Natural "counting" loop  do-while Least flexible Always executes loop body at least on  while Most flexible No “restrictions 12
  • 13.  It is a repeated structure which can repeat a statement as long as the given condition is satisfied. for(statement1; condition; statement2) statement3; 13
  • 14. While loop while(condition) statement1; Do while loop do { statement1; } while(condition); 14
  • 15.  The types of jump statement are: 1)Break 2)Continue 3)Goto 4)Exit 5)Return 15
  • 17. 17
  • 18. 18