Structured Programming

Structured Programming - ELSE Statement2 Statements1...

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

View Full Document Right Arrow Icon
Structured Programming The Basics
Background image of page 1

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

View Full DocumentRight Arrow Icon
Control structures They control the order of execution What order statements will be done in, or whether they will be done at all (skipping) Different from data structures – which are ways to access data, to operate on it
Background image of page 2
Why do structured programming? It's easier to understand code written using structured programming Easier to test and debug code Easier to modify and maintain code Easier to work with other people to write large programs
Background image of page 3

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

View Full DocumentRight Arrow Icon
4 Control Structures Sequence Selection Iteration Module
Background image of page 4
Guarantees for All Structures ONE Entrance ONE Exit
Background image of page 5

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

View Full DocumentRight Arrow Icon
SEQUENCE Statement 1 Statement 2 Statement 3 . . .
Background image of page 6
Guarantees for Sequences Will execute the steps in the order given Will not enter or leave sequence in mid- stream Will not skip steps
Background image of page 7

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

View Full DocumentRight Arrow Icon
SELECTION(branch) IF Condition THEN Statement1
Background image of page 8
Background image of page 9

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

View Full DocumentRight Arrow Icon
Background image of page 10
Background image of page 11

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

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

Unformatted text preview: ELSE Statement2 Statements1 Statement Statements2 Condition . . . True False Selection Guarantees Control always enters through the condition / question One branch or the other is executed, never both on one run MUST execute one branch or the other Processes in branches can be as large or small as you want Do not write Dead Code! LOOP(repetition) Body Condition . . . False True WHILE Condition DO Statement1 Guarantees Will go through test / condition at top to get into loop ALL of body will be executed before test is done again Body will be repeated until test is answered differently (NO) Do not write Infinite Loops! SUBPROGRAM(function) SUBPROGRAM1 . . . SUBPROGRAM1 a meaningful collection of SEQUENCES, SELECTIONS, LOOPS, SUBPROGRAM calls...
View Full Document

Page1 / 12

Structured Programming - ELSE Statement2 Statements1...

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

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