Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 2: Beginning the Problem-Solving Process

Similar presentations


Presentation on theme: "Chapter 2: Beginning the Problem-Solving Process"— Presentation transcript:

1 Chapter 2: Beginning the Problem-Solving Process
Introduction to Programming with C++ Fourth Edition

2 Objectives Explain the problem-solving process used to create a computer program Analyze a problem Complete an IPO chart Plan an algorithm using pseudocode and flowcharts Desk-check an algorithm Introduction to Programming with C++, Fourth Edition

3 Problem Solving/Solving Everyday Problems
Steps include: Analysis Planning Review Implementation Evaluation Modification Introduction to Programming with C++, Fourth Edition

4 Analysis and Planning Introduction to Programming with C++, Fourth Edition

5 Modified Algorithm Introduction to Programming with C++, Fourth Edition

6 Creating Computer Solutions to Problems
Introduction to Programming with C++, Fourth Edition

7 Analyzing the Problem Purpose of analyzing the problem:
to determine the goal to determine the items needed to achieve the goal Introduction to Programming with C++, Fourth Edition

8 Analyzing the Problem (continued)
Introduction to Programming with C++, Fourth Edition

9 IPO (Input, Processing, Output) Charts
Used by programmers to organize and summarize the results of a problem analysis To determine input: Search the problem specification for an answer to the following question: What information will the computer need to know to print, display, or store the output items? Introduction to Programming with C++, Fourth Edition

10 IPO Chart with Input and Output
Introduction to Programming with C++, Fourth Edition

11 Determining Important Information
If you are not sure if a piece of information is important, ask yourself this question: If I didn’t know this information, could I still solve the problem? When reading a problem specification, it helps to use a pencil to lightly cross out unnecessary information Introduction to Programming with C++, Fourth Edition

12 Problem Specification
Introduction to Programming with C++, Fourth Edition

13 Problem Specification Lacking Information
Introduction to Programming with C++, Fourth Edition

14 Problem Specification with Input not Stated
Introduction to Programming with C++, Fourth Edition

15 Planning the Algorithm
Processing item - an intermediate value that the algorithm uses when processing the input into the output Pseudocode - a tool programmers use to help them plan an algorithm Flowchart - uses standardized symbols to show the steps the computer needs to take to accomplish the program’s goal Introduction to Programming with C++, Fourth Edition

16 Completed IPO Chart Introduction to Programming with C++, Fourth Edition

17 IPO Chart with Flow Chart
Introduction to Programming with C++, Fourth Edition

18 Flowchart Symbols Flowlines - used to connect symbols
Start/stop symbol (oval) – indicates beginning of flowchart Process symbols (rectangles) – used to represent tasks such as calculations Input/output symbol (parallelogram) - used to represent input tasks Introduction to Programming with C++, Fourth Edition

19 Solving Sarah’s Problem
Introduction to Programming with C++, Fourth Edition

20 IPO Chart for Problem Specification
Introduction to Programming with C++, Fourth Edition

21 Hints for Planning Algorithms
Introduction to Programming with C++, Fourth Edition

22 Desk-Checking the Algorithm
Reasons for desk-checking: To verify that the program is not missing any steps To verify that the existing steps are correct and in the proper order Introduction to Programming with C++, Fourth Edition

23 Desk-Check Table with New Weekly Pay
Introduction to Programming with C++, Fourth Edition

24 Results of Second Desk-Check
Introduction to Programming with C++, Fourth Edition

25 The Gas Mileage Problem
Introduction to Programming with C++, Fourth Edition

26 The Gas Mileage Problem (continued)
Analyze the problem looking for nouns and adjectives that represent both input and output Output should answer the following question: What does the user want to see printed on paper, displayed on the screen, or stored in a file? Input should answer the following question: What information will the computer need to know to print, display, or store the output items? Introduction to Programming with C++, Fourth Edition

27 IPO Chart Introduction to Programming with C++, Fourth Edition

28 Completed Desk-Check Table
Introduction to Programming with C++, Fourth Edition

29 Summary Explain the problem-solving process used to create a computer program Complete an IPO chart Use algorithms (pseudocode) and flowcharts Use desk-checking techniques Introduction to Programming with C++, Fourth Edition


Download ppt "Chapter 2: Beginning the Problem-Solving Process"

Similar presentations


Ads by Google