{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

6.Sequencing(A) - Control Structures(A Topics to cover here...

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

View Full Document Right Arrow Icon
Control Structures (A) Topics to cover here: Introduction to Control Structures in the algorithmic language Sequencing
Background image of page 1

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

View Full Document Right Arrow Icon
Control Structures In your algorithm (or program), you can use different types of statements. Each statement starts with a specific keyword (except for the assignment statement (see later)). There are 3 categories of control structures: 1- Sequencing 2- Selection 3- Repetition
Background image of page 2
1- Sequencing It is a sequential control given in a compound statement or a block. A compound statement (or a block ) is a sequence of statements ordered in a way to give a solution: e.g. S1 S2 S3 is a sequence of 3 statements In C++, the ; symbol is used to separate statements.
Background image of page 3

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

View Full Document Right Arrow Icon
1- Sequencing (Cont.) The statements that have a sequential control: 1- INPUT/OUPUT statements 2- Assignment statement INPUT/OUPUT statements INPUT statement (in pseudo code): Use Input statement to input data into variables from the standard input device (e.g. a keyboard).
Background image of page 4
INPUT Statement Syntax: INPUT List of variables where, List of variables contains one or more variables e.g. INPUT x INPUT a, b The semantics (execution) of this statement : You can enter the values you want for the variables in the statement from the keyboard and the computer will assign these values into the variables (stores them in memory).
Background image of page 5

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

View Full Document Right Arrow Icon
OUPUT Statement (in pseudo code) The OUTPUT statement has many uses. Use OUTPUT statement to output - The values of variables stored in memory. - A message (i.e. a string of characters). - The value of an expression.
Background image of page 6
OUPUT Statement (in pseudo code).. cont. Syntax: 1- OUTPUT List of variables where, List of variables contains one or more variables e.g. OUTPUT x OUTPUT a, b The semantics (execution) of this statement: This statement allows the computer to access the locations of the variables mentioned in the statement and displays their contents on an output device (e.g. a screen).
Background image of page 7

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

View Full Document Right Arrow Icon
OUPUT Statement (in pseudo code).. cont.
Background image of page 8
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}