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

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Control Structures (A) Topics to cover here: • Introduction to Control Structures in the algorithmic language • Sequencing 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. 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). 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). OUPUT Statement (in pseudo code).. cont....
View Full Document

This note was uploaded on 02/23/2011 for the course CHEMICAL E 2 taught by Professor Hibasaadeh during the Spring '11 term at University of Jordan.

Page1 / 28

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

This preview shows document pages 1 - 9. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online