1. CHAPTER ONE
PROBLEM SOLVING
Objectives:
1- Understand what is “ Programming”?
2- Define “Problem” & “ Problem Solving”.
3- Identify the 5- Stages of Problem Solving.
4-Writing “ Algorithm”
5-Draw “ Flow Chart”
2. 1- Understand what is “ Programming”?
Eat a meal Cook that meal
Buy A Robot Build A Robot
Use a Game / Software Create yours with your OWN Criteria
Programmer
Programming Languages : C , C++, Basic , Visual C , Visual Basic
3. 2- Define “Problem” & “ Problem Solving”.
Objectives
Outputs
Target/Aim/Goal
- Sequence
of Steps
-Activities
Specific
Inputs
Attain / Reach Through Using
Problem Problem Solving
4. Define :
1- Problem.
2- Problem Solving .
Ex:
1- “ Blue Hole” / “Black or White Desert”/ “Cosmic Village”
2- Bake a Cake.
5. 3- “ Problem Solving” Stages (5 Stages) :
1. Define the Problem:
1. Outputs.
2. Inputs.
3. Executing Arithmetic or Logical Operations
Example (1):
2 + 3
Example (2):
A kid have 100 pounds, bought a dark choc. for 48 pounds &
bottle of water for 4 pounds, So ??
6. 3- “ Problem Solving” Stages (5 Stages) Cont.
2. Step by step solving problems:
1. Write an Algorithm
الخوارزمي
2. Draw a Flow Chart
1. Start
2. Inputs : 2, 3
3. Sum of 2 + 3
4. Output the
Sum.
5. End
Example (1):
2 + 3
Input 2 , 3
Start
Sum = 2 + 3
Output Sum
End
7. Benefits if using Flowcharts:
1- Promotes / facilitate understanding the
problem and shows the tasks when writing
program codes.
2- Explains the program to others
3- Convenient tool for documenting the
program.
8. The Algorithm is :
A Group of logically arranged procedures to be
executed to attain an output using specific inputs.
The Flow Chart is:
It’ a diagram uses standard Graphical symbols or
shapes to illustrate a sequence of steps required to
solve the problem.
The Algorithm is represented by
drawing flowcharts.
9. 3- “ Problem Solving” Stages (5 Stages) cont.
3. Design the Program:
Writing the code
Using a programming Language
10. 3- “ Problem Solving” Stages (5 Stages) cont.
4. Program Testing ( Debug):
During writing program code we can make mistake.
So, We have to check and enter the data and compare to check
the errors and debug / Correct them.
1. Start
2. Inputs : 2, 3
3. Sum of 2 - 3
4. Output the
Sum.
5. End
Example (1):
2 + 3
11. 3- “ Problem Solving” Stages (5 Stages) cont.
5. Program Documentation:
Is documenting : Given input – output – plan – for solving the
problem – drawn flow chart – programming language – last date
modification – people who contribute to the program development
Process. WHY ??? To go back for feedback or correction
13. Flow Chart:
Diagram that uses standard graphical symbols
to illustrate:
the sequence of steps required for solving a
problem or specific question ( the algorithm)
14. The most commonly used Symbols:
Symbols
Significance
(Terminal): Start & End
( Input / Output )
(Process): Arithmetic / Logical
(Decision): Yes / No
(Flow Lines): Directions
15. Example(1-1):
Draw a flow chart that will calculate the sum of two numbers
entered by the user and display the result:
Third : Flow Chart
Second : Algorithm
1- Start
2- Enter The Number A and the Number B
3- Perform the SUM using : C=A+B , while C
is the output
4- Print C
5- End
First : Define the Problem
Outputs: The sum of Two Numbers
Inputs: The 1st number is “A”, The 2nd number is “B”
Solution: C = A+B , where C is the result
Start
Enter A and B
C = A+ B
Output C
End