CS 20

Problem
Solving

 
CS 20 Home
Problem Solving Index
 
Problem Solving Theory
Problem Solving Exercises
Problem Solving Resources
Structured Programming
  Theory page 2
updated 07-Jun-2005
   
 
  back next  
 
 

   Given a piece of paper and only the rules given for flowcharts, one can quickly create a truly monstrous flowchart that while correct and useable, is very difficult to program. The following chart is an example;
chaotic flowchart
  While this was possible and more common than not in the past, the wise of the ancient programmers came up with a set of rules called Structured Programming. These rules would create clear, clean programming code free from the horrors of spider-web flowcharts. The rules are based on the idea that there are really only three basic types of program flow. With these three simple types or structures, one can create any possible type of complex flow yet still be understandable and easy to program.

Sequential or Process Block

Decision or Branching structure

Repetitive or Looping structure
This structure is one or more tasks that follow directly after each other. This structure splits the flow between two or more possible paths. All paths join back together after completing their specific procedure This structure repeats a block of instructions for a certain amount of times or based on some condition.
process block decision structure looping structure
 
 
  back next