Skip to main content
Engineering LibreTexts

11.3: Flowcharting

  • Page ID
    10305
  • \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    \( \newcommand{\id}{\mathrm{id}}\) \( \newcommand{\Span}{\mathrm{span}}\)

    ( \newcommand{\kernel}{\mathrm{null}\,}\) \( \newcommand{\range}{\mathrm{range}\,}\)

    \( \newcommand{\RealPart}{\mathrm{Re}}\) \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

    \( \newcommand{\Argument}{\mathrm{Arg}}\) \( \newcommand{\norm}[1]{\| #1 \|}\)

    \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

    \( \newcommand{\Span}{\mathrm{span}}\)

    \( \newcommand{\id}{\mathrm{id}}\)

    \( \newcommand{\Span}{\mathrm{span}}\)

    \( \newcommand{\kernel}{\mathrm{null}\,}\)

    \( \newcommand{\range}{\mathrm{range}\,}\)

    \( \newcommand{\RealPart}{\mathrm{Re}}\)

    \( \newcommand{\ImaginaryPart}{\mathrm{Im}}\)

    \( \newcommand{\Argument}{\mathrm{Arg}}\)

    \( \newcommand{\norm}[1]{\| #1 \|}\)

    \( \newcommand{\inner}[2]{\langle #1, #2 \rangle}\)

    \( \newcommand{\Span}{\mathrm{span}}\) \( \newcommand{\AA}{\unicode[.8,0]{x212B}}\)

    \( \newcommand{\vectorA}[1]{\vec{#1}}      % arrow\)

    \( \newcommand{\vectorAt}[1]{\vec{\text{#1}}}      % arrow\)

    \( \newcommand{\vectorB}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vectorC}[1]{\textbf{#1}} \)

    \( \newcommand{\vectorD}[1]{\overrightarrow{#1}} \)

    \( \newcommand{\vectorDt}[1]{\overrightarrow{\text{#1}}} \)

    \( \newcommand{\vectE}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash{\mathbf {#1}}}} \)

    \( \newcommand{\vecs}[1]{\overset { \scriptstyle \rightharpoonup} {\mathbf{#1}} } \)

    \( \newcommand{\vecd}[1]{\overset{-\!-\!\rightharpoonup}{\vphantom{a}\smash {#1}}} \)

    \(\newcommand{\avec}{\mathbf a}\) \(\newcommand{\bvec}{\mathbf b}\) \(\newcommand{\cvec}{\mathbf c}\) \(\newcommand{\dvec}{\mathbf d}\) \(\newcommand{\dtil}{\widetilde{\mathbf d}}\) \(\newcommand{\evec}{\mathbf e}\) \(\newcommand{\fvec}{\mathbf f}\) \(\newcommand{\nvec}{\mathbf n}\) \(\newcommand{\pvec}{\mathbf p}\) \(\newcommand{\qvec}{\mathbf q}\) \(\newcommand{\svec}{\mathbf s}\) \(\newcommand{\tvec}{\mathbf t}\) \(\newcommand{\uvec}{\mathbf u}\) \(\newcommand{\vvec}{\mathbf v}\) \(\newcommand{\wvec}{\mathbf w}\) \(\newcommand{\xvec}{\mathbf x}\) \(\newcommand{\yvec}{\mathbf y}\) \(\newcommand{\zvec}{\mathbf z}\) \(\newcommand{\rvec}{\mathbf r}\) \(\newcommand{\mvec}{\mathbf m}\) \(\newcommand{\zerovec}{\mathbf 0}\) \(\newcommand{\onevec}{\mathbf 1}\) \(\newcommand{\real}{\mathbb R}\) \(\newcommand{\twovec}[2]{\left[\begin{array}{r}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\ctwovec}[2]{\left[\begin{array}{c}#1 \\ #2 \end{array}\right]}\) \(\newcommand{\threevec}[3]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\cthreevec}[3]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \end{array}\right]}\) \(\newcommand{\fourvec}[4]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\cfourvec}[4]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \end{array}\right]}\) \(\newcommand{\fivevec}[5]{\left[\begin{array}{r}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\cfivevec}[5]{\left[\begin{array}{c}#1 \\ #2 \\ #3 \\ #4 \\ #5 \\ \end{array}\right]}\) \(\newcommand{\mattwo}[4]{\left[\begin{array}{rr}#1 \amp #2 \\ #3 \amp #4 \\ \end{array}\right]}\) \(\newcommand{\laspan}[1]{\text{Span}\{#1\}}\) \(\newcommand{\bcal}{\cal B}\) \(\newcommand{\ccal}{\cal C}\) \(\newcommand{\scal}{\cal S}\) \(\newcommand{\wcal}{\cal W}\) \(\newcommand{\ecal}{\cal E}\) \(\newcommand{\coords}[2]{\left\{#1\right\}_{#2}}\) \(\newcommand{\gray}[1]{\color{gray}{#1}}\) \(\newcommand{\lgray}[1]{\color{lightgray}{#1}}\) \(\newcommand{\rank}{\operatorname{rank}}\) \(\newcommand{\row}{\text{Row}}\) \(\newcommand{\col}{\text{Col}}\) \(\renewcommand{\row}{\text{Row}}\) \(\newcommand{\nul}{\text{Nul}}\) \(\newcommand{\var}{\text{Var}}\) \(\newcommand{\corr}{\text{corr}}\) \(\newcommand{\len}[1]{\left|#1\right|}\) \(\newcommand{\bbar}{\overline{\bvec}}\) \(\newcommand{\bhat}{\widehat{\bvec}}\) \(\newcommand{\bperp}{\bvec^\perp}\) \(\newcommand{\xhat}{\widehat{\xvec}}\) \(\newcommand{\vhat}{\widehat{\vvec}}\) \(\newcommand{\uhat}{\widehat{\uvec}}\) \(\newcommand{\what}{\widehat{\wvec}}\) \(\newcommand{\Sighat}{\widehat{\Sigma}}\) \(\newcommand{\lt}{<}\) \(\newcommand{\gt}{>}\) \(\newcommand{\amp}{&}\) \(\definecolor{fillinmathshade}{gray}{0.9}\)

    Flowcharting Symbols

    Terminal

    The rounded rectangles, or terminal points, indicate the flowchart's starting and ending points.

    Figure \(\PageIndex{1}\)

    Process

    The rectangle depicts a process such as a mathematical computation, or a variable assignment.

    Note: the C++ language equivalent is the statement.

    Figure \(\PageIndex{2}\)

    Input/Output

    The parallelograms designate input or output operations.

    Note: the C++ language equivalent is cin or cout.

    Figure \(\PageIndex{3}\)

    Connectors

    Sometimes a flowchart is broken into two or more smaller flowcharts. This is usually done when a flowchart does not fit on a single page, or must be divided into sections. A connector symbol, which is a small circle with a letter or number inside it, allows you to connect two flowcharts on the same page. A connector symbol that looks like a pocket on a shirt, allows you to connect to a flowchart on a different page.

    On-Page Connector

    Figure \(\PageIndex{4}\)

    Off-Page Connector

    Figure \(\PageIndex{5}\)

    Decision

    The diamond is used to represent the true/false statement being tested in a decision symbol.

    Figure \(\PageIndex{6}\)

    Module Call

    A program module is represented in a flowchart by rectangle with some lines to distinguish it from process symbol. Often programmers will make a distinction between program control and specific task modules as shown below.

    Note: C++ equivalent is the function.

    Local module: usually a program control function.

    Figure \(\PageIndex{7}\)

    Library module: usually a specific task function.

    Figure \(\PageIndex{8}\)

    Flow Lines

    Note: The default flow is left to right and top to bottom (the same way you read English). To save time arrowheads are often only drawn when the flow lines go contrary the normal.

    Figure \(\PageIndex{9}\)

    Examples

    We will demonstrate various flowcharting items by showing the flowchart for some pseudocode.

    Functions

    Pseudocode: Function with no parameter passing
    Function clear monitor
      Pass In: nothing
      Direct the operating system to clear the monitor
      Pass Out: nothing
    Endfunction 
    

    Figure \(\PageIndex{10}\)

    Pseudocode: Function main calling the clear monitor function
    Function main
      Pass In: nothing
      Doing some lines of code
      Call: clear monitor
      Doing some lines of code
      Pass Out: value zero to the operating system
    Endfunction 
    

    Figure \(\PageIndex{11}\)

    Sequence Control Structures

    The next item is pseudocode for a simple temperature conversion program. This demonstrates the use of both the on-page and off-page connectors. It also illustrates the sequence control structure where nothing unusually happens. Just do one instruction after another in the sequence listed.

    Pseudocode: Sequence control structure
    Filename: Solution_Lab_04_Pseudocode.txt
    Purpose:  Convert Temperature from Fahrenheit to Celsius
    Author:   Ken Busbee; © 2008 Kenneth Leroy Busbee
    Date:     Dec 24, 2008
    
    Pseudocode = IPO Outline
    
    input
      display a message asking user for the temperature in Fahrenheit
      get the temperature from the keyboard
    processing
      calculate the Celsius by subtracting 32 from the Fahrenheit
      temperature then multiply the result by 5 then
      divide the result by 9. Round up or down to the whole number.
      HINT: Use 32.0 when subtracting to ensure floating-point accuracy.
    output
      display the celsius with an appropriate message
      pause so the user can see the answer 
    

    Figure \(\PageIndex{12}\)

    Figure \(\PageIndex{13}\)

    Selection Control Structures

    Pseudocode: If then Else
    If age > 17
      Display a message indicating you can vote.
    Else
      Display a message indicating you can't vote.
    Endif 
    

    Figure \(\PageIndex{14}\) If then Else control structure

    Pseudocode: Case
    Case of age
      0 to 17   Display "You can't vote."
      18 to 64  Display "Your in your working years."
      65 +      Display "You should be retired."
    Endcase 
    

    Figure \(\PageIndex{15}\) Case Control Structure

    Iteration (Repetition) Control Structures

    Pseudocode: While
    count assigned zero
    While count < 5
      Display "I love computers!"
      Increment count
    Endwhile 
    

    Figure \(\PageIndex{16}\) While control structure

    Pseudocode: For
    For x starts at 0, x < 5, increment x
      Display "Are we having fun?"
    Endfor 
    

    The for loop does not have a standard flowcharting method and you will find it done in different ways. The for loop as a counting loop can be flowcharted similar to the while loop as a counting loop.

    Figure \(\PageIndex{17}\) For control structure

    Pseudocode: Do While
    count assigned five
    Do
      Display "Blast off is soon!"
      Decrement count
    While count > zero 
    

    Figure \(\PageIndex{18}\) Do While control structure

    Pseudocode: Repeat Until
    count assigned five
    Repeat
      Display "Blast off is soon!"
      Decrement count
    Until count < one
    

    Figure \(\PageIndex{19}\) Repeat Until control structure

    Definitions

    Flowcharting
    A programming design tool that uses graphical elements to visually depict the flow of logic within a function.
    Process Symbol
    A rectangle used in flowcharting for normal processes such as assignment.
    Input/Output Symbol
    A parallelogram used in flowcharting for input/output interactions.
    Decision Symbol
    A diamond used in flowcharting for asking a question and making a decision.
    Flow Lines
    Lines (sometimes with arrows) that connect the various flowcharting symbols.

    This page titled 11.3: Flowcharting is shared under a CC BY license and was authored, remixed, and/or curated by Kenneth Leroy Busbee (OpenStax CNX) .

    • Was this article helpful?