CSE-.
Structured Programming
1101
Rafid Mostafiz
IIT, NSTU
Structured Programming
2
Structured programming is the set of design and
implementation processes that yield well-structured
programs.
Structured programming is a problem solving strategy
and a programming methodology that includes the
following guidelines
The flow of control in the program should be as simple
as possible
The construction of a program should embody top-
down design
Features
3
Easy to write:
Modular design increases the programmer's
productivity by allowing them to look at the big picture
first and focus on details later.
Easy to debug
Since each procedure is specialized to perform just one
task, a procedure can be checked individually.
Easy to Understand
The relationship between the procedures shows the
modular design of the program.
Features
4
Easy to Change
Since a correctly written structured program is self-
documenting, it can be easily understood by another
programmer
Structured Programming
5
Advantages of structured programming
Standard method for solving a problem
Easier to test and debug than straight-line or modular
programs
Structured walkthroughs
A single program can be written by more than one
programmer
Programs can share routines
Help minimize thrashing
Structured Programming
6
A disciplined approach to programming
Top-down design
Step-wise refinement using a restricted set* of
program structures
* The set of program structures used in structured
programming is:
Sequence
Choice
Loop
Top-Down Design
7
A program is divided into a main module and its
related modules. Each module is in turn divided
into submodules until the resulting modules are
understood without further division.
What Are the Rules for Writing a
8
Structured Program?
3 basic structures
Sequence
Decision (selection)
Repetition (looping or iteration)
Sequence Structure
9 Write a
Can contain any symbol line
except for the decision symbol
Move
Steps are executed in Score to
sequence with no instruction High-Score
changing the order
Do
Low-Score
Do
Average
Decision Structures
10
If…Then If…Then…Else
Case
If…Then
11
Is
Add 1 to
Code =
Yes Code1-Count
1?
No
If…Then…Else
12
Is
Gender =
No "F"? Yes
Do Male Do Female
Do Benefit-
Analysis
Repetition (Looping or Iteration)
13
Structures
Top-test loop
Bottom-test
loop
14
Any Question?