{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

6.Sequencing(A)

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

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

Control Structures (A) Topics to cover here: Introduction to Control Structures in the algorithmic language Sequencing

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

View Full Document
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
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.

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

View Full Document
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).
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).

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

View Full Document
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.
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).

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

View Full Document
OUPUT Statement (in pseudo code).. cont.
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}