You are on page 1of 1

Math School – High School Documents Symbolic Logic Whiteboard Lesson Plans – Mr.

Kevin Rivera

SL 07 – Algorithms and Pseudocode (Part 1)

DEFINITIONS while () { Step 1: Writing the Algorithm


It’s used to repeat certain 1. Message: “The first five positive integers are:”
1. Variable: A memory cell or space that can }
Loops steps until a sentinel or a 2. Start Showing the Numbers.
for () { counter stop it.
store information, like a number (int or a. Separate them by Comma.
} b. Period after the last one (5).
float), a word (char) or a list (array).
It’s used to introduce
2. Pseudocode: A fictional programming Input cin >> information and store it Step 2: Designing a Flowchart
language used to formally write an in a variable.

algorithm sequence. It’s used to send a


Output cout << message on the screen.
Pseudocode Notation
Pseudocode language depends on its own creator, Space It’s used to make a jump
\n between lines.
Jumping
because it’s a fictional language, people can
decide how it works and which symbols it uses. It’s used to compare two
objects (variable or
Comparison == constant) and return
For this class, our pseudocode language will be
Boolean values.
very similar (actually, identical) to C++ Language:
:= It’s used to save
#include <iostream> Assignation = information inside a
<- variable.
int main() {
Start-End
Here goes the Algorithm… It’s used for writing
} Comment // explanations that aren’t
part of the algorithm.
It’s used to create a
Define New int variable. Variables are Step 3: Programming with Pseudocode
Variable float considered as memory #include <iostream>
cells in a computer. Writing Pseudocode Programs int main() {
It’s used ALWAYS after //Defining Variables
The algorithm sequence explained through the use int n=1;
any operation, to close it
Closure ; and continue with the of a pseudocode or a real coding language is called
next operation. a program, and they’re the foundation of another cout<< “The first five positive integers are: ”;
while (n<5) {
if () { It’s used for conditions, discipline called Programming. cout<< n;
} where the True-Case cout << “, ”;
Decision follows (if), and the Example:
else { n=n+1;
} False-Case follows (else). }
1) Make a pseudocode program that shows
cout<< n << “.”;
the first 5 positive integers, using a loop. }

You might also like