The problem solving is defined as the objective or the
specific output that we want to attain, through a
sequence of steps and activities and, specific input.
Problem
Solving
Stages
Define the Problem
Outline the solution
Develop the outline into an algorithm
Test the algorithm for correctness
code the algorithm into a specific
programming language
Run the program on the computer
Document and maintain the
program
Divide the problem into components
(called IPO):
Inputs: Outputs: Processing:
what do you what do you how do you go from
have? want to have? inputs tooutputs?
Outline the solution
The major The major
The major The major control variables and The mainline
involved. subtasks (if any). structures (e.g. record logic.
repetition loops). structures.
Develop the outline into an algorithm
An Example
Step 1 Start
▪ Algorithm is a set of precise steps
Step 2 declare three integers x, y & z
that describe exactly the tasks to
be performed, and the order in
Step 3 define values of x & y
which they are to be carried out.
Step 4 multiply values of x & y
Step 5 store result of step 4 to z
▪ Pseudocode (a form of structured
English) is used to represent the Step 6 print z
solution algorithm.
Step 7 Stop
Test the algorithm for correctness
▪ The main of desk checking the
algorithm is to identify major
logic errors early, so that they
may be easily corrected.
▪ Testing data needs to be walked
through each step in the algorithm, to
check that the instructions described
in the algorithm will actually do what
they are supposed to.
code the algorithm into a specific
programming language
▪ we write the program to solve the given
problem using programming languages like
C, C++, Visual Basic, Java, etc.,
Document and maintain the program
▪ All steps taken for solving the problem that include
given Input, output, plan for solving the problem,
drawn flowchart, programming language used for
coding and, instructions, date of last modification of
the program and, people who contribute to the
program development process, to have the program
documented to go back for feedback and correction.
▪ Programming is the process of creating a set of
instructions that tell a computer how to perform a
task. Programming can be done using a variety of
computer programming languages.
▪ Is a set of rules, symbols and special words you can
use to write instructions and construct a computer
program; according to the programming language
used. Instructions will be translated to machine
language for being executed.
Examples of some of the
programming languages:
Levels of programming
languages
programming languages
Why can't we use a natural language
like English to write programs?
▪ Computers are too stupid to understand English.
▪ English would make a bad programming language
because it is ambiguous (words have more than one meaning).