Download presentation
Presentation is loading. Please wait.
Published byHoratio Patrick Modified over 8 years ago
1
Problem Solving and Program Design in C Chap. 1 Overview of Computers and Programming Chow-Sing Lin
2
CSIE@NUTN Computers Computer Technology is everywhere!! – Virtually every aspect of your life depends on computers. The computer program’s role in this technology is essential – Without a list of instructions to follow, the computer is virtually useless. One of the most versatile programming languages available today the C language Dr. Chow-Sing LinProgram Design I - CH12
3
CSIE@NUTN Electronic Computers Then and Now The First Computer built in 1930s by Dr. John Atanasoff and Dr. Clifford Berry at Iowa State University. (ABC) – Atanasoff-Berry-Computer (ABC) – Used in nuclear physics with mathematical computations Dr. Chow-Sing LinProgram Design I - CH13
4
CSIE@NUTN ABC Dr. Chow-Sing LinProgram Design I - CH14
5
CSIE@NUTN ENIAC The first large-scale, general-purpose electronic digital computer – ENIAC – Electronic Numerical Integrator and Computer – Built in 1946 at the Univ. of Pennsylvania with funding from the U.S. army. – Used to compute ballistics tables, predict the weather, make atomic energy calculations – Weight :30 tons; Space: 30 x 50 ft 2 Used vacuum tubes as their basic electronic component. Dr. Chow-Sing LinProgram Design I - CH15
6
CSIE@NUTN ENIAC Dr. Chow-Sing LinProgram Design I - CH16
7
CSIE@NUTN Electronic Technology advance Technological advances in the design and manufacture of electronic components led to new generations of computers – Smaller, faster, and less expensive Nowadays, the entire circuitry of a computer processor can be packaged in a single electronic component, microprocessor chip Dr. Chow-Sing LinProgram Design I - CH17
8
CSIE@NUTN Dr. Chow-Sing LinProgram Design I - CH18 Figure 1.1 The Intel Atom processor chip contains the full circuitry of a central processing unit in an integrated circuit whose small size and low power requirements make it suitable for use in mobile internet devices. (Intel Corporation Pressroom Photo Archives)
9
CSIE@NUTN Computer Category Modern computers are categorized according to their size and performance – Personal computers Used by a single person at a time – Mainframes Large real-time transaction processing systems – Supercomputers The largest capacity and fastest mainframes Intensive computation applications Dr. Chow-Sing LinProgram Design I - CH19
10
CSIE@NUTN Dr. Chow-Sing LinProgram Design I - CH110 1-10 Figure 1.2 (a) Notebook Computer (HP Pavilion dv5©, Courtesy of Hewlett-Packard). (b) Palmtop Computer (iPhone 3G©, Courtesy of Apple, Inc.) (c) Desktop Computer (iMac©, Courtesy of Apple, Inc.)
11
CSIE@NUTN Elements of Computer System Hardware – Perform the necessary computations Central processing unit, monitor, keyboard, mouse, printer, speakers Processing data represented only by 0 and 1 (binary numbers) Software – Programs to solve problems with a computer by providing it with lists of instructions to perform Dr. Chow-Sing LinProgram Design I - CH111
12
CSIE@NUTN Computer Hardware Main Memory Secondary Memory – Hard disks, floppy disk, DVDs, …. Central Processing Unit Input Devices – Keyboards, mouses, touch pads, …. Output Devices – Monitors, printers, and speakers Dr. Chow-Sing LinProgram Design I - CH112
13
CSIE@NUTN Component of a Computer Dr. Chow-Sing LinProgram Design I - CH113
14
CSIE@NUTN Memory Imagine the memory of a computer as an ordered sequence of storage locations memory cells To store and access information, the computer use an unique address to identify the individual cell. Data and programs are stored in the memory cells – Stored program concept: a program’s instruction must be stored in main memory before they can be executed. Dr. Chow-Sing LinProgram Design I - CH114
15
CSIE@NUTN Memory Layout Dr. Chow-Sing LinProgram Design I - CH115 Figure 1.4 1000 Memory Cells in Main Memory
16
CSIE@NUTN Byte and Bit 0 and 1 one bit 8 bits 1 byte one character Dr. Chow-Sing LinProgram Design I - CH116
17
CSIE@NUTN Main Memory RAM(random access memory) – Temporary storage of programs and data – Volatile memory Everything in RAM will be lost when the computer is switched off ROM(read-only memory) – Store read-only information permanently within the computer – Not volatile – Store start-up instructions and other critical instructions Dr. Chow-Sing LinProgram Design I - CH117
18
CSIE@NUTN Secondary Memory Computer systems provide storage in addition to main memory for two reasons: 1.Computers need storage permanent or semi- permanent so that information can retained during a power loss or when the computer is turn off. 2.Systems typically store more information than will fit in memory. Hard disk, DVD, magnetic tape, ….. Dr. Chow-Sing LinProgram Design I - CH118
19
CSIE@NUTN Central Processing Unit Play two roles – Coordinating all computer operations – Performing arithmetic and logical operations on data To Process a program stored in main memory, – the CPU retrieves (fetch) each instruction in sequence, interprets the instruction, and then retrieves any data needed to carry out that instruction. – Execute, and store the result back to memory Dr. Chow-Sing LinProgram Design I - CH119
20
CSIE@NUTN Computer Network Link computers together to communicate with one another Dr. Chow-Sing LinProgram Design I - CH120 LAN, Local Area NetworkWAN, Wide Area Network
21
CSIE@NUTN Operating System A middleware (program) between computer hardware and users – Loading the operating system into memory is called booting the computer Operating System is responsible for – Communicate with the computer users – Managing allocation of memory, processor time, and other resources for tasks – Collecting input from other input devices (mouse..) – Conveying program out to other output devices (screen..) – Access/writing data from/to secondary storage Dr. Chow-Sing LinProgram Design I - CH121
22
CSIE@NUTN Application Software Application software is running on top of the operating system – Microsoft office – Google Chrome – Photoshop – ….. Dr. Chow-Sing LinProgram Design I - CH122
23
CSIE@NUTN Computer Languages Machine language – Binary code 001011, 001101, …. – hardly readable by human – CPU dependent Assembly language – More readable, but still hard to learn CLA, ADD A, STA A, …. – One assembly instruction corresponding to one machine language Dr. Chow-Sing LinProgram Design I - CH123
24
CSIE@NUTN Table 1.3 A machine language program fragment and its assembly language equivalent Memory AddressesMachine Language Instructions Assembly Language Instructions 00000000 CLA 0000000100010101ADD A 0000001000010110ADD B 0000001100110101STA A 0000010001110111HLT 00000101?A ? 00000110?B ? Dr. Chow-Sing LinProgram Design I - CH124
25
CSIE@NUTN Computer language (cont’) Write code, run any platform CPU- independent high-level language High-level language – Combine algebraic expressions and symbols taken from English Table 1.3 can be replaced by a single high-level language a = a + b ; C, C++, Java, php, C#, Python, …… Dr. Chow-Sing LinProgram Design I - CH125
26
CSIE@NUTN Computer language(cont’) High-level language must be translated into the target computer machine language Source file object file executable file RUN Dr. Chow-Sing LinProgram Design I - CH126
27
CSIE@NUTN Dr. Chow-Sing LinProgram Design I - CH127 Figure 1.12 Entering, Translating, and Running a High-Level Language Program
28
CSIE@NUTN Figure 1.13 Flow of Information During Program Execution Dr. Chow-Sing LinProgram Design I - CH128
29
CSIE@NUTN The Software Development Method 1.Specify the problem requirement – State the problem clearly and unambiguously and to gain a clear understanding of what is required for its solution. 2.Analyze the problem – Identify the problem Input Output Additional requirement and constraints on the solution Dr. Chow-Sing LinProgram Design I - CH129
30
CSIE@NUTN The Software Development Method (cont’) 3.Design the algorithm to solve the problem – Develop a list of steps called an algorithm to solve the problem and to then verify that the algorithm solves the problem as intended. – Writing the algorithm is often the most difficult part of the problem-solving process. – List the major steps, and then refine. – Desk check!! 4.Implement the algorithm – Converting each algorithm step into one or more statements in a programming language, such as C. Dr. Chow-Sing LinProgram Design I - CH130
31
CSIE@NUTN The Software Development Method (cont’) 5.Test and verify the completed program – Testing the completed program to verify that it works as desired. – Run the program several times using different sets of data to ensure its correctness in every aspects. 6.Maintain and update the program – Modifying a program to remove previously undetected errors – keep it up-to-date as government regulations or company policies change. Dr. Chow-Sing LinProgram Design I - CH131
32
CSIE@NUTN Failure is part of the process !! Debugging !! Dr. Chow-Sing LinProgram Design I - CH132
33
CSIE@NUTN Dr. Chow-Sing LinProgram Design I - CH133 Figure 1.14 Miles-to-Kilometers Conversion Program
34
CSIE@NUTN Be sure to read the Chapter Review at the end of each chapter and understand the listed topics ! Do as many implementation exercises as possible ! Dr. Chow-Sing LinProgram Design I - CH134
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.