Problem Solving and Program Design in C 5

Problem Solving and Program Design in C (5 th Edition) by Jeri R. Hanly and Elliot B. Koffman Chapter 1 (Software Development Method) © CPCS 202 12 -10 -1429

# CHAPTER 1 1. The Software Development Method 2. Exercise Terms to Remember 3. column shows the topics index. column shows the programs index. 2

1 The Software Development Method A. Introduction B. You need to be a problem solver A good problem solver a good programmer Programmers use the Software Development Method (method to develop software) This is what you will learn in this course. Prototype 1. 2. 3. 4. 5. 6. Problem Analysis Design / Algorithm Implementation Testing Maintenance Outline 3

1 The Software Development Method C. Example 1. 2. 3. 4. 5. 6. Problem Analysis Design / Algorithm Implementation Testing Maintenance 1. Problem: “define the problem you are trying to solve” Your summer surveying job requires you to study some maps that give distances in kilometers and some that use miles. You and your coworkers prefer to deal in metric measurements. Write a program that performs the necessary conversion. 4

1 The Software Development Method C. Example 1. 2. 3. 4. 5. 6. Problem Analysis Design / Algorithm Implementation Testing Maintenance 2. Analysis ( )ﺗﺤﻠﻴﻞ : “define the inputs and the outputs of the program” 1. Problem Input: miles 2. Problem Output: kilometers 3. Relevant Formula: 1 mile = 1. 609 kilometers 5

1 The Software Development Method C. Example 1. 2. 3. 4. 5. 6. Problem Analysis Design / Algorithm Implementation Testing Maintenance 3. Design / Algorithm: “steps to solve the problem and could be written any way, but they have to be understandable” 1. Get the distance in miles from the user. 2. Convert the distance to kilometers. (1 miles = 1. 609 kilometer) 3. Display the distance in kilometers on the screen. 6

1 The Software Development Method C. Example 1. 2. 3. 4. 5. 6. Problem Analysis Design / Algorithm Implementation Testing Maintenance 4. Implementation: ( )ﺗﻨﻔﻴﺬ “write the code” 7

1 The Software Development Method C. Example 1. 2. 3. 4. 5. 6. Problem Analysis Design / Algorithm Implementation Testing Maintenance 5. Testing: “verify that the program works properly by trying few test cases” 8

1 The Software Development Method C. Example 1. 2. 3. 4. 5. 6. Problem Analysis Design / Algorithm Implementation Testing Maintenance 6. Maintenance ( )ﺻﻴﺎﻧﺔ / Debugging: “remove undetected errors” 9

2 Problem Analysis Design Outline Implementation Testing Maintenance Exercise Type the following code in an editor, and then run it: 1. 2. 3. 4. 5. 6. 7. 8. 9. #include <stdio. h> int main(void) { // 1. Display “Hello World!!” on the screen printf("Hello World!!n"); return(0); } Try to understand the output message: ------ Build started: Project: Prog 2_1, Configuration: Debug Win 32 -----Compiling. . . Linking. . . DebugBuild. Log. htm" Prog 2_1 - 0 error(s), 0 warning(s) Note: you will understand the meaning of the code later 10

3 Terms to Remember Programming Language Software Development Method Editor Compile Linking Run a program (Compiling then Linking) Build Debug Test Case 11
- Slides: 11