Lecture Stage of Problem Solving
Lecture Stage of Problem Solving
Computer
1
Introduction
• Number of problems in our daily life.
• Suppose we have to calculate Simple
Interest.
• Suppose we have to prepare a mark
sheet.
• A computer cannot do anything alone
without software i.e. Program
2
• A software is a set of programs written
to solve a particular problem
3
Never Ever Forget
• Just writing code is not sufficient to
solve a problem.
Algorithm Development
Flowcharting
Program Coding
Documentation
7
2. Algorithm Development
• Step By Step description of the
method to solve a problem.
10
An algorithm to find largest of three
different numbers:
11
Three features of Algorithm
• 1. Sequence
– Each step in the algorithm in executed in specified order. If not algorithm
will fail.
• 2. Decision
– We have to make decision to do something.
– If the outcome of the decision is true, one thing is done otherwise other.
• If condition then process1
OR
• If condition
then process1
Else process2
• 3. Repetition
– For example,
Repeat
Fill Water in the kettle
Until Kettle is full
12
3. Flowcharting
• Graphical representation of an algorithm using
standard symbols.
13
Advantages of Flowcharts
• Communication
– Quickly provide logic, ideas and descriptions of
algorithms.
• Effective Analysis
– Clear overview of the entire problem.
• Proper Documentation
– Documents the steps followed in an algorithm.
– Helps us understand its logic in future.
• Efficient Coding
– More ease with comprehensive flowchart as a guide
• Easy in debugging and program
maintenance
– Debugging and maintenance of operating program 14
Flowchart
Symbols
15
Things to consider
• There should be start and stop to the
flowchart.
Step1: Start
Step2: Display “Enter two
numbers”.
Step3: Read A and B
Step4: C= A+B
Step5: Display “C as sum of two
numbers”
17
Step6: Stop
Flowchart
START Start
Read two
Numbers, A and
Input
B
C=A+B Processing
Display C as Sum of A
and B
Output
END End
18
4. Coding
• The process of transforming the program logic
design into computer language format.
20
Execution
• Once the compilation is completed then the
program is linked with other object programs
needed for execution, there by resulting in a
binary program and then the program is loaded
in the memory for the purpose of execution and
finally it is executed.
21
Debugging and Testing
22
Debugging and Testing
• Testing ensures that program performs correctly
the required task.
1. Programmer’s Documentation
(Technical Documentation)
• Maintain, redesign and upgrade
• Logic, DFD, E-R, algorithm and flowchart
2. User Documentation (User Manual)
• Support to the user of the program
• Instructions for installation of the program
25
Compiler
• A high level source program must be translated into a form
machine can understand. This done by software called the
compiler.
27