1.programming and Problem Solving-1
1.programming and Problem Solving-1
Concepts
People make decisions every day to solve problems that affect their lives.
The problems may be as unimportant as what to watch on television or as
important as choosing a new job. If a bad decision is made, time and resources are
lost, so it’s important that people know how to make decisions well.
1. Computational :
problems involving some kind of mathematical processing
2. Logical :
Problems involving relational or logical processing
3. Repetitive :
Problems involving repeating a set of mathematical and/or logical
instructions.
-----------------------------------------------------------------------------------------------------------------------
1
Problem Solving with computers:
Step 1: Problem definition and specification, which is given by the full and
detailed description of the problem.
Step 2: Problem analysis. Based on the definition of the problem and data to be
used, in this step the problem is to be analyzed to its main components.
Step 5: Program transfer to the computer. The first form of the program is
known as the source program. This step includes also correcting syntax and
semantic errors in the program.
Step 6: Program testing and translation. The compiler translates the error-free,
source program into object program, after being tested using several data sets to
detect any logic errors.
------------------------------------------------------------------------------------------------------------------------------
The problem-solving process is not easy. It takes practice and time to perfect, but
in the long run the process proves to be of great benefit.
When solving problems on the computer, one of the most difficult tasks for the
problem solver is writing the instructions. Take the task of deciding which number
is the largest from a group of three numbers. Almost anyone can immediately tell
which is the largest, but many cannot explain the steps they followed to arrive at it.
Most people will say, “I can’t explain how I know, I just know it!” This
explanation is not good enough for the computer. The computer is a tool that will
perform only tasks that the user can explain.
The computer has a specific system of communication that programmers and users
must learn. This system demands that no step in the solution to a problem be left
unstated and that all steps be in the proper order. You must assume the computer
knows nothing except what you tell it and think of it as an ignorant but efficient aid
to problem solving.
------------------------------------------------------------------------------------------------------------------------------
Flowchart:
------------------------------------------------------------------------------------------------------------------------------
Subprogram call
Connection
1. Sequential flowchart
------------------------------------------------------------------------------------------------------------------------------
Each type of flowchart could be described by its features which are represented in
the following paragraphs.
Generally, the problem should be analyzed before deciding about the solution. The
logical order of steps of the solution indicates the type of flowcharts to be used, i.e.
the final form of the solution.
In addition to these three main types, nested loops in flowcharts represent another
flowchart type which is used when the solution includes the dependence of one
loop parameters on the parameters of another loop.
1. Sequential flowchart
------------------------------------------------------------------------------------------------------------------------------
In this type of flowcharts, one or more decision boxes are introduced, and
the action taken depends upon whether the result of the decision test is true
(yes) or false (no). This operation is illustrated by Fig. 2.
------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------------------------------