Download presentation
Presentation is loading. Please wait.
Published bySharyl Ramsey Modified over 9 years ago
1
Chapter 1 Engineering Problem Solving 1
2
Hardware and Software 2 A computer is a machine designed to perform operations specified with a set of instructions called a program. Hardware refers to the computer equipment. keyboard, mouse, terminal, hard disk, printer Software refers to the programs that describe the steps we want the computer to perform.
3
Computer Hardware 3 CPU - Central processing unit ALU - Arithmetic and logic unit ROM - Read only memory RAM - Random access memory CPU Internal Memory External Memory InputOutput Processor ALU
4
Computer Software 4 Operating System - Provides an interface with the user unix, windows, linux,... Software Tools word processors (MicrosoftWord, WordPerfect,...) spreadsheet programs (Excel, Lotus1-2-3,...) mathematical computation tools (MATLAB, Mathematica,...) Computer Languages machine language assembly language binary language high level languages (C, C++, Ada, Fortran, Basic, java)
5
Executing a Computer Program 5 Compiler Converts source program to object program Linker Converts object program to executable program CompileLink/loadExecute C language program Machine language program Program output Input data
6
Key Terms 6 Source Program printable/Readable Program file Object Program nonprintable machine readable file Executable Program nonprintable executable code Syntax errors reported by the compiler Linker errors reported by the linker Execution/Run-time errors reported by the operating system
7
The C Programming Language 7 General purpose, machine-independent language Developed at Bell Labs in 1972 by Dennis Ritchie American National Standards Institute(ANSI) approved ANSI C standard in 1989
8
Software Life-Cycle Phases 8
9
Problem Solving Methodology 9 1. Problem Statement 2. Input/output description 3. Hand example 4. Algorithm Development 5. Testing
10
Example 1 10 1. Problem statement Compute the straight line distance between two points in a plane 2. Input/output description Point 1 (x1, y1) Point 2 (x2, y2) Distance between two points (distance) (x1,y1) (x2, y2)
11
Example 1(cont’d) 3. Hand example side1 = 4-1 = 3 side2 = 7-5 = 2 11
12
Example 1(cont’d) 12 4. Algorithm development and coding a. Generalize the hand solution and list/outline the necessary operations step-by-step 1) Give specific values for point1 (x1, y1) and point2 (x2, y2) 2) Compute side1=x2-x1 and side2=y2-y1 3) Compute 4) Print distance b. Convert the above outlined solution to a program using any language you want (see next slide for C imp.)
13
Example 1(cont’d) 13
14
Example 1(cont’d) 14 5. Testing After compiling your program, run it and see if it gives the correct result. Your program should print out The distance between two points is 3.61 If not, what will you do?
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.