234k views
5 votes
What are the different kinds of program control structures?

User Cvacca
by
6.8k points

1 Answer

3 votes

Answer:

Flow of Control:

Flow of control through any given function is implemented with three basic types of control structures:

Sequential: default mode. Sequential execution of code statements (one line after another) -- like following a recipe

Selection: used for decisions, branching -- choosing between 2 or more alternative paths. In C++, these are the types of selection statements:

if

if/else

switch

Repetition: used for looping, i.e. repeating a piece of code multiple times in a row. In C++, there are three types of loops:

while

do/while

for

User Hampo
by
7.5k points