Sie sind auf Seite 1von 18

Ch-3

Problem solving & Program development

Problem-Solving
Problem-solving is a mental process that involves discovering, analyzing and solving problems. The ultimate goal of problem-solving is to overcome obstacles and find a solution that best resolves the issue.

Steps in Problem-Solving
Identifying the Problem Defining the Problem Forming a Strategy Organizing Information Allocating Resources Monitoring Progress Evaluating the Results

What is programming?
Programming is instructing a computer to do something for you with the help of a programming language. The role of a programming language can be described in two ways: Technical: It is a means for instructing a Computer to perform Tasks Conceptual: It is a framework within which we organize our ideas about things and processes.

In programming we deal with two kind of things: data, representing ``objects'' we want to manipulate procedures, i.e. ``descriptions'' or ``rules'' that define how to manipulate data.

Need Of Programming

Steps in Program Development


Define the problem Outline the solution Develop the outline into an algorithm Test the algorithm for correctness Code the algorithm into a programming language Run the program on computer Document and maintain the program

Algorithm
An algorithm is a finite set of precise instructions for performing a computation or solving a problem. Algorithm analysis: a process of determining the amount of time, resource, etc. required when executing an algorithm.

Each instruction should be precise and clear. Each instruction should be executed in a finitetime. One or more instructions should not berepeated Infinitely. After executing the instructions the desiredresult are obtained. It range from Simple to the Complex.

Characteristics of Algorithm

Developing an Algorithm
1. 2. 3. 4. 5. Identify the Inputs Identify the Processes Identify the Outputs Develop a HIPO Chart Identify modules

1. Identify the Inputs


What data do I need? How will I get the data? In what format will the data be?

2. Identify the Processes


How can I manipulate data to produce meaningful results? Data vs. Information

3. Identify the Outputs


What outputs do I need to return to the user? What format should the outputs take?

4. Develop a HIPO Chart


Hierarchy of Inputs Processes & Outputs
PROBLEM

INPUT

PROCESSES

OUTPUT

MODULE

MODULE

MODULE

MODULE

MODULE

MODULE

5. Identify Relevant Modules


How can I break larger problems into smaller, more manageable pieces? What inputs do the modules need? What processes need to happen in the modules? What outputs are produced by the modules?

The Flowchart
A Flowchart
shows logic of an algorithm emphasizes individual steps and their interconnections e.g. control flow from one action to the next

It is a symbolic diagram of operationsequence, dataflow, control flow andprocessing logic in information processing. The symbol used are simple and easy to learn. It is a very help full tool for programmers andbeginners.

Advantages of flowchart.
Communication. Effective analysis. Proper documentation. Efficient coding. Proper debugging. fficient program maintenance. E Easy and clear presentation.

Complex logic. Drawing is time consuming. Alteration and modification. Redrawn many times. Difficult to draw and remember. Reproduction ( replica ). Technical detail.

Limitation of flowchart

Flowchart Symbols
Basic
Name Symbol Use in Flowchart Oval Denotes the beginning or end of the program

Parallelogram

Denotes an input operation

Rectangle

Denotes a process to be carried out e.g. addition, subtraction, division etc.

Diamond

Denotes a decision (or branch) to be made. The program should continue along one of two routes. (e.g. IF/THEN/ELSE)

Hybrid

Denotes an output operation

Flow line

Denotes the direction of logic flow in the program

Das könnte Ihnen auch gefallen