C Prog Lesson 1
C Prog Lesson 1
C Prog Lesson 1
Problem Solving
Lesson 1
What is a
COMPUTE
R?
A COMPUTER is a
programmable
machine that receives
input,
stores
and
manipulates data, and
provides output in a
useful format.
(Wikipedia)
COMPUTE
R
Programm
able
Machine
Software
Hardware
Software
is any set of machine-readable
instructions (program) that
directs a computer's processor
to perform specific operations.
Algorithm
a
step-by-step
list
of
instructions for solving any
instance of the problem.
2 Tools in
Representing
Algorithms
Flowchart
Pseudo-code
Flowchart:
Represents an algorithm
in graphical symbols
Pseudo-code
also describes the essential
steps to be taken, but
without the graphical
enhancements.
Flowchart Symbols
Symb
ol
Meaning
The terminator
symbolrepresents the start
points, end points, and
potential outcomes of a path.
The data symbol(also called
the input/output symbol)
represents data that is
available for input or output. It
may also represent resources
used or generated.
Flowchart Symbols
Symb
ol
Meaning
The process
symbolrepresents a process,
action, or function. Its the
most widely-used symbol in
flowcharting.
The decision
symbolindicates a question to
be answeredusually yes/no or
true/false. The flowchart path
may splinter into different
Flowchart Symbols
Symb
ol
Meaning
The connector
symbolconnects separate
elements across one page. Its
usually used within complex
charts.
The preparation
symboldifferentiates between
steps that prepare for work and
steps that actually do work.
The Flow lineused to indicate
Sample Pseudocode:
MAKING A
TEA
Fill kettle with
water
Heat water
IF water boiled then
Make a tea
ELSE
Heat water
Sample
Flowchart:
STAR
T
MAKING A
TEA
Fill kettle
w/ water
Heat water
No
Has the
water
boiled?
-Terminator Symbol
-Data Symbol
-Process Symbol
-Decision Symbol
Yes
Make a tea
End
-Process Symbol
-Terminator Symbol