c prog lesson 1
TRANSCRIPT
-
8/18/2019 c prog Lesson 1
1/17
Introduction to
Problem Solving
Lesson 1
-
8/18/2019 c prog Lesson 1
2/17
-
8/18/2019 c prog Lesson 1
3/17
ACOMPUTER
is a
programmablemachine that receives
input, stores andmanipulates data, and
provides output in auseful format.
(Wikipedia)
-
8/18/2019 c prog Lesson 1
4/17
COMPUTER
Programm
able
Machine
Software Hardware
-
8/18/2019 c prog Lesson 1
5/17
Software
• is any set of machine-readableinstructions (program) thatdirects a computer's processor
to perform specic operations!
"lgorithm
•a step-by-step list ofinstructions for solving anyinstance of the problem!
-
8/18/2019 c prog Lesson 1
6/17
# $ools in
%epresenting"lgorithms
•
&lowchart•Pseudo-code
-
8/18/2019 c prog Lesson 1
7/17
Flowchart:
Represents an algorithmin graphical symbols
-
8/18/2019 c prog Lesson 1
8/17
Pseudo-code
•also describes the essentialsteps to be taen but
without the graphicalenhancements!
-
8/18/2019 c prog Lesson 1
9/17
-
8/18/2019 c prog Lesson 1
10/17
&lowchart Symbols
Symbol
Meaning
The terminatorsymbol represents the startpoints end points andpotential outcomes of a path!
The data symbol (also called
the input*output symbol)represents data that isavailable for input or output! Itmay also represent resources
used or generated!
-
8/18/2019 c prog Lesson 1
11/17
&lowchart Symbols
Symbol
Meaning
The rocesssymbol represents a processaction or function! It+s themost widely-used symbol in,owcharting!
The decisionsymbol indicates a uestion tobe answered.usually yes*no ortrue*false! $he ,owchart path
may splinter into di/erent
-
8/18/2019 c prog Lesson 1
12/17
-
8/18/2019 c prog Lesson 1
13/17
Samle Pse"do#code1
M$%&'( $
TE$ &ill ettle with
water
2eat waterI& water boiled then
3ae a tea
45S4
2eat water
-
8/18/2019 c prog Lesson 1
14/17
S$"% $
&ill ettle
w* water
2eat water
2as thewater
boiled?
3ae a tea
4nd
Samle!lowchart1
M$%&'( $
TE$
-$erminator Symbol
-6ata Symbol
-Process Symbol
-6ecision Symbol
-Process Symbol
-$erminator Symbol
7o
8es
-
8/18/2019 c prog Lesson 1
15/17
Create a )owchart for the
following stes in wa*ing # "
•"larm rings
•
If not ready to get up•2it snoo9e button
•Sleep again
•4lse turn o/ alarm
•:limb out of bed
-
8/18/2019 c prog Lesson 1
16/17
Create a )owchart for thefollowing stes in going to
school
•5eave home
•
:hec time• If before ;1
-
8/18/2019 c prog Lesson 1
17/17
Create a )owchart for thefollowing stes in ma*ing atea>! &ill ettle with water
#! $ae cup out of cupboard
@! "dd teaA! Pour water
;! If reuire sugar
B! et a sugar out of the cupboardC! "dd sugar
D! 4lse do nothing
>=!If reuire mil
>> $ae mil out of the frid e