Creating Flowcharts
-
Creating a flowchart is often a difficult task
- You are trying to think of a logical ordering of tasks to solve a problem,
and that requires a lot of thought, depending on the complexity of the problem
- Don't be afraid to try different methods or refine a working method to make
it simpler or more efficient
- Expect to use your eraser a lot!
- I usually start by writing out the variables I expect to use and
then manipulate them from start to finish as I try various solutions
to the given problem
-
Flowcharting primitives
- Input: Get a number and call it X
- Output: Write the answer Z
- Assignment: A ← 10 or X ← Y + 2
- Basic arithmetic: + - * / and finding remainders
- Compare two values: Is X < Y? Is D = 0?
- Use sub-process (along with another flowchart) to build more sophisticated operations like
determining if a number is prime
- How do you know your flowchart is correct?
- First make sure it is structured
- Try using a simple case. For example, if the flowchart is computing
X to the power of Y, try 2 for X and 3 for Y to see if you get 8.
- After you've verified your flowchart works for the simple case, try
other cases that you think could introduce logic errors. For example,
what if X is 1 or 0?
-
Common logic errors:
- Off-by-one error - A loop that performs one too many or one
too few iterations
- Infinite loop - A loop that never terminates
- Never used statement - Process that will never
execute because there is no logical path leading to the process
- OverFlow
- OverFlow was created by Gabriel Foust for creating flowcharts and watching them
execute automatically
- Download OverFlow for free (Windows only)
- OverFlow tutorial