0% found this document useful (0 votes)
120 views5 pages

Pseudocode and Flowchart Basics

The document discusses pseudocode and flowcharts, which are used in the planning stage of software design before coding. Pseudocode uses an informal language to describe the step-by-step logic of a program, while flowcharts use standard symbols to visually represent the program flow. An example prompt is provided and both pseudocode and a flowchart are written to demonstrate how to plan a program to calculate the area of a rectangle based on user input and display an output message.

Uploaded by

Michael T. Bello
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
120 views5 pages

Pseudocode and Flowchart Basics

The document discusses pseudocode and flowcharts, which are used in the planning stage of software design before coding. Pseudocode uses an informal language to describe the step-by-step logic of a program, while flowcharts use standard symbols to visually represent the program flow. An example prompt is provided and both pseudocode and a flowchart are written to demonstrate how to plan a program to calculate the area of a rectangle based on user input and display an output message.

Uploaded by

Michael T. Bello
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
  • Introduction to Pseudocode and Flowcharts
  • Calculation Example
  • Symbols Used in Flowchart
  • Flowchart and Decision Making
  • Conclusion and Resources

Pseudocode and Flowcharts

An often overlooked aspect of software design is the planning stage that must occur before any
code is written. The pseudocode and flowchart are integral to this part of the process and for
minimizing the number of missteps that can occur when determining how to approach an
assignment. This handout will use an example prompt to explain and demonstrate the process
of writing pseudocode and creating a flowchart.

Pseudocode
Pseudocode informally describes the step-by-step process that will be implemented to solve a
problem or accomplish a task. It is useful for planning the logic behind each step of a program
and forces the programmer to think critically about what must be accomplished. Therefore, it
should always be written before the program code. The pseudocode’s informal description
allows non-programmers to understand how the program should operate.

When beginning to develop pseudocode, it is important to think about the steps that are
needed to solve the given problem. For example, a programmer may be tasked with solving the
following prompt:

Create a program that prompts a user to enter the length and width of a rectangle and
then calculates the area of the rectangle based on the user’s input. If the area is greater
than 100 square units, a message should be displayed that states, “That is a large
rectangle.” Otherwise, the message should state, “That is a small rectangle.”

In programming, the order in which problems are usually solved is to first define the variables,
then perform necessary calculations, and finally, display outputs. Problems that are more
complex will involve more steps but will likely follow the same general order. In the example
prompt, the variables, which are the length and width, are defined by the user’s input.
Therefore, the first two steps of the pseudocode must involve prompting the user to enter the
length and width of the rectangle. The beginning of the pseudocode will be the following:

Define the length by asking for user input


Define the width by asking for user input

Provided by Pseudocode and Flowcharts


The Academic Center for Excellence 1 September 2021
After the length and width are defined, the area of the rectangle needs to be calculated. The
formula for the calculation will be the length multiplied by the width (length * width); it is a
good practice to include the formula for steps that involve calculations in the pseudocode. The
next step of the pseudocode is shown below.

Calculate the area (length * width)

After the area of the rectangle has been calculated, the program can then determine the
correct output. The output will depend upon the area, so a decision must be made. An “If-Else”
statement will be used to determine what the output should be. An “If-Else” statement is a
conditional statement that will provide different outcomes based on whether the given
condition is true or false. For example, if the statement “The area is greater than 100 square
units” is true, the outcome of the condition will be different than if the same condition is false.
In the context of the example prompt, if the statement is true, then a message should be
displayed that states, “That is a large rectangle.” If the statement is false, the message should
instead state, “That is a small rectangle.” The final steps of the pseudocode demonstrate the If-
Else statement:

If the area is greater than 100 square units


Display “That is a large rectangle.”
Else
Display “That is a small rectangle.”

Flowchart
The flowchart is used to represent program flow and, much like pseudocode, should be created
before any code is written. It utilizes shapes to depict the different processes that occur
throughout a program.

The table shown on the next page features the shapes that are used in a flowchart and the
actions that they represent.

Provided by Pseudocode and Flowcharts


The Academic Center for Excellence 2 September 2021
Symbols Used In Flowchart
Symbol Purpose Description
Indicates the flow of logic
Flow line
by connecting symbols.

Represents the start and


Terminal (Stop/Start)
the end of a flowchart.

Used for input and output


Input/Output
operation.
Used for arithmetic
Processing operations and data-
manipulations.
Used for decision making
Decision between two or more
alternatives.
Flowchart in programming (n.d.). Programiz. [Link]

The flowchart for this example will follow the same order as the pseudocode. Every flowchart
must begin and end with the terminal shape to signify the beginning and end of the program’s
operation. Additionally, a flow line should be added between shapes to demonstrate how the
program will flow.

The first two steps of the pseudocode, “Define the length by asking for user input” and “Define
the width by asking for user input,” are both prompting the user to enter data and are
therefore considered inputs. As shown in the image that depicts the flowchart symbols, the
shape that represents input and output is a parallelogram, so two parallelograms will follow the
beginning terminal shape.

Provided by Pseudocode and Flowcharts


The Academic Center for Excellence 3 September 2021
The next step of the program is to calculate the area, which would be considered a process
because it is an arithmetic operation. This step will be depicted in a rectangle.

After the area is calculated, a decision must be made regarding whether the condition is true or
false. In this example, the condition is if the size of the area is greater than 100. Decisions are
depicted by having two pathways emerge from the diamond shape: one path represents the
events that occur if the condition is true, while the other shows the results of the condition
being false.

As stated in the prompt, a message should be displayed after the decision is made. Regardless
of the area of the rectangle, the shape for output will be placed in both the “true” and “false”
pathway, and then lead to the end. The finished flowchart for the example prompt is shown on
the next page.

Provided by Pseudocode and Flowcharts


The Academic Center for Excellence 4 September 2021
The Academic Center for Excellence (ACE) offers free on-campus or online tutoring
appointments for software design. For further assistance with programming concepts, please
call ACE at (540) 891-3017 or email us at ACE@[Link].

Provided by Pseudocode and Flowcharts


The Academic Center for Excellence 5 September 2021

Common questions

Powered by AI

When implementing pseudocode for a problem involving user input and conditional logic, the sequence should start with defining variables by taking user inputs, in this case, the length and width of a rectangle . Next, perform necessary calculations such as computing the area using length * width . Finally, apply conditional logic using an If-Else statement to display different outputs based on whether conditions like area size thresholds are met .

Decision-making elements in flowcharts, represented by diamond shapes, play a crucial role by visually delineating conditional logic paths, enabling clear depiction of the program's branching logic as seen in the rectangle area example . They allow program designers to explicitly outline separate actions following true or false evaluations, such as determining whether the rectangle area exceeds 100 units, which results in different messages being displayed . This structured approach simplifies complex logic by clearly showing multiple decision pathways and their outcomes, ensuring a concise understanding of flow dynamics and outcomes .

Flowcharts and pseudocode complement each other by serving as dual aspects of program visualization and design planning. Pseudocode provides a textual, linear outline of the logic involved, specifying step-by-step operations and decisions in a human-readable manner . Flowcharts, on the other hand, transform this linear logic into a visual map of processes, decisions, and data flow, allowing for intuitive understanding of potential decision loops and paths . Together, they allow a comprehensive assessment by verifying assumptions and logic consistency, thereby reducing design errors and fostering a thorough preparation phase before actual coding .

The planning stages, such as drafting pseudocode and flowcharts before coding, significantly reduce programming errors by ensuring that the program logic is fully thought through and validated before implementation . They help identify potential logical errors and inefficiencies by providing detailed schematic views of the program's intended operation, thus allowing errors to be caught early in the design process . By outlining the program's structure and conditional paths in advance, programmers can minimize logical flaws and improve the efficiency of the final code .

Providing multiple output paths in a flowchart, as demonstrated in the rectangle area example, benefits the program design by clearly illustrating different outcomes based on various conditions . It showcases how the program will respond to different inputs or states, making it easier to understand the logic and predict behavior for all scenarios . This clarity helps in identifying and testing each path individually, ensuring comprehensive coverage of possible execution paths, which is crucial for robust program development and debugging .

Flowcharts offer cognitive advantages by visually simplifying complex logic into a series of understandable steps, differentiating operations through specific shapes like parallelograms for input/output and diamonds for decisions, which enhances comprehension . They provide a holistic view of how data flows through various decisions and processes, facilitating easier detection of flaws and inefficiencies than text-based code alone . Their visual representation helps in memory retention and comprehension of sequential logic by simplifying the understanding of loops and branched pathways typically found in complex programs .

Including specific calculation formulas in pseudocode enhances program development efficiency and accuracy by providing explicit instructions for arithmetic operations, reducing the likelihood of misinterpretation during coding . It ensures that critical mathematical operations are accurately represented and expected outcomes are clearly defined, streamlining the transition from planning to actual coding . By outlining these details in advance, developers can focus on optimization and testing, rather than corrective measures for wrongly implemented logic .

Using pseudocode contributes to software design by allowing developers to informally describe the step-by-step processes needed to solve a problem or accomplish a task without delving into code syntax, making it accessible to non-programmers . It serves as a planning tool to outline the logic behind program steps, which helps in critical thinking about task execution . This can minimize error and missteps during the coding phase by ensuring logical flow and task clarity .

The primary symbols used in flowcharts include the terminal symbol (oval) for start and end points, flow lines (arrows) for indicating logic flow, parallelograms for input and output operations, rectangles for processing steps (arithmetic or data manipulation), and diamonds for decision-making with alternatives .

Pseudocode facilitates communication among team members by offering an informal, human-readable description of a program's logic without syntax complexities, allowing non-programmers to grasp the program flow and logic . Its simplicity and structure enable team members from diverse backgrounds to participate in the software design process, ensuring a clearer and more collaborative development environment .

Provided by 
 
Pseudocode and Flowcharts 
The Academic Center for Excellence 
1 
September 2021 
Pseudocode and
Provided by 
 
Pseudocode and Flowcharts 
The Academic Center for Excellence 
2 
September 2021 
After the length and width
Provided by 
 
Pseudocode and Flowcharts 
The Academic Center for Excellence 
3 
September 2021 
Symbols Used In Flowchart
Provided by 
 
Pseudocode and Flowcharts 
The Academic Center for Excellence 
4 
September 2021 
 
The next step of the pro
Provided by 
 
Pseudocode and Flowcharts 
The Academic Center for Excellence 
5 
September 2021 
 
 
The Academic Center fo

You might also like