If you can't read please download the document
Upload
sherman-smith
View
219
Download
2
Tags:
Embed Size (px)
Citation preview
Introduction to Computers (L02)
* Hardware* Software* Programming Languages* Three Phase of Program Development* Development and Design Steps* Algorithms* Flowchart Introduction to Computers and Programming Dr. Ming Zhang
Basic Hardware Units of a Computer
Central Processing Unit Arithmetic & Logic Unit
Input Control Output
Memory Second Storage Introduction to Computers and Programming Dr. Ming Zhang
Computer Software* Machine Language 11000000 000000000001* Assemble Language ADD 1, 2* High-Level Language Pascal, C, C++* System Software DOS, UNIX* Applications Microsoft Word Introduction to Computers and Programming Dr. Ming Zhang
Programming Languages (1) Operation: Input (get the data)
FORTRAN: READBASIC: INPUT, READ/DATACOBOL: READ, ACCEPTPascal: READ, READLNC: getchar(), gets(), scanf(), sscanf()C++: cin Introduction to Computers and Programming Dr. Ming Zhang
Programming Languages (2) Operation: Output (display the data)
FORTRAN: WRITE, PRINTBASIC: PRINT, PRINT/USINGCOBOL: WRITE, DISPLAYPascal: WRITE, WRITELNC: putchar(), puts(), printf(), sprintf()C++: cout Introduction to Computers and Programming Dr. Ming Zhang
Three Phase of Program DevelopmentProgram Life Cycle Phase
Maintenance(3)
Documentation(2)
Development and Design(1)
Time Introduction to Computers and Programming Dr. Ming Zhang
Development and Design StepsDevelopment & Design Steps
Test & Correct Solution
Code Solution Develop Solution
Analyse Problem Time Introduction to Computers and Programming Dr. Ming Zhang
Algorithms* Definition of AlgorithmAn algorithm is defined as a step-by-step sequence of instructions that must terminate and describes how the data is to be processed to produce the desired outputs
* Question for Developing an AlgorithmIn essence, an algorithm answers the question, What method will you use to solve this problem? Introduction to Computers and Programming Dr. Ming Zhang
Algorithm for Calculating the Average 1Step1: input a, b, and c.
Step2: calculate the average of a, b, and c.
Step 3: display the average.
step 4: stop. Introduction to Computers and Programming Dr. Ming Zhang
Algorithm for Calculating the Average 2Step1: input value and assign value to Ai, i = 1,2, 3, ...n.Step 2: if no more input value, go to step 3, otherwise go to step 1 Step3: calculate the average of Ai, i = 1,2, 3, ...n.Step 4: display the average.Step 5: stop. Introduction to Computers and Programming Dr. Ming Zhang
Flowchart Symbols (1)Symbol Name Description
Terminal Indicates the beginning or end of an algorithm
Input/Output Indicate an Input or Output operation
Process Indicates computation or data manipulation Introduction to Computers and Programming Dr. Ming Zhang
Flowchart Symbols (2)Symbol Name Description Flow Lines Used to connect the flowchart symbols and indicates the logic flow
Decision Indicates a decision point in the program
Loop Indicates the initial, final, and increment values of a loop Introduction to Computers and Programming Dr. Ming Zhang
Flowchart Symbols (3)Symbol Name Description Predefined Indicates a predefined Process Process, as in calling a sorting process
ConnectorIndicates an entry to, or exit from, another part of the flowchart Introduction to Computers and Programming Dr. Ming Zhang
Flowchart for Calculating the Average 1
Start
Input values for a, b, and c
Calculate the average
Display the average
End Introduction to Computers and Programming Dr. Ming Zhang
Flowchart for Calculating the Average 2
Start
Input values for Ai
End of Calculate the averageN input? YDisplay the average
End Introduction to Computers and Programming Dr. Ming Zhang
Calculate the Average of 100 Numbers
Starti = 1 i=i+1 Input values for Ai
Calculate the averageN i=100? YDisplay the average
End Introduction to Computers and Programming Dr. Ming Zhang