Chapter 2 Introduction To Programming
Chapter 2 Introduction To Programming
Chapter 2 Introduction To Programming
Problem Solving
People solve hundreds of simple problems every
day without thinking about how they do it
Understanding the thought process involved can
help in solving more complex problems
You can also use a similar process to design a
computer solution to a problem (computer
program)
Figure 2-5 Partially completed IPO chart showing the input and output items
10
11
Figure 2-7 Problem specification that does not contain enough information
12
Figure 2-8 Problem specification in which the input is not explicitly stated
13
14
Figure 2-9 Problem specification and IPO chart for the Treyson Mobley problem
An Introduction to Programming with C++, Sixth Edition
15
16
17
18
19
20
21
22
23
24
Figure 2-18 Second set of input values entered in the desk-check table
25
26
27
28
29
Summary
Problem solving typically involves analyzing the
problem and then planning, reviewing,
implementing, evaluating, and modifying (if
necessary) the solution
Programmers use tools (IPO charts, pseudocode,
flowcharts) to help them analyze problems and
develop algorithms
The first step in problem solving is to analyze the
problem
First determine the output and then the input
An Introduction to Programming with C++, Sixth Edition
30
Summary (contd.)
The second step is to plan the algorithm
Write the steps that will transform the input into the
output
Most algorithms begin with entering input data, then
processing the data, then displaying the output
31
32
33
34
35
36