An Overview of Computers and Programming Languages
An Overview of Computers and Programming Languages
An Overview of
Computers and
Programming
Languages
Objectives
In this chapter, you will:
Learn about different types of computers
Explore the hardware and software
components of a computer system
Learn about the language of a computer
Learn about the evolution of programming
languages
Examine high-level programming languages
Objectives (contd.)
Introduction
Without software, the computer is useless
Software is developed with programming
languages
C++ is a programming language
Abacus, Pascaline
Leibniz device
Jacquards weaving looms
Babbage machines: difference and analytic
engines
Hollerith machine
Mark I
ENIAC
Von Neumann architecture
UNIVAC
Transistors and microprocessors
Categories of computers
Mainframe computers
Midsize computers
Micro computers (personal computers)
Elements of a Computer
System
Hardware
CPU
Main memory
Secondary storage
Input/Output devices
Software
Hardware
CPU
Main memory: RAM
Input/output devices
Secondary storage
10
11
12
13
Secondary Storage
Secondary storage: device that stores
information permanently
Examples of secondary storage:
Hard disks
Flash drives
Floppy disks
Zip disks
CD-ROMs
Tapes
14
Input/Output Devices
Input devices feed data and programs into
computers
Keyboard
Mouse
Secondary storage
15
Software
Software: programs that do specific tasks
System programs control the computer
Operating system monitors the overall activity
of the computer and provides services such as:
Memory management
Input/output activities
Storage management
16
The Language of a
Computer
Analog signals: continuous wave forms
Digital signals: sequences of 0s and 1s
Machine language: language of a
computer; a sequence of 0s and 1s
Binary digit (bit): the digit 0 or 1
Binary code (binary number): a sequence
of 0s
and 1s
17
The Language of a
Computer (contd.)
Byte:
A sequence of eight bits
18
The Language of a
Computer (contd.)
19
The Language of a
Computer (contd.)
EBCDIC
Used by IBM
256 characters
Unicode
65536 characters
Two bytes are needed to store a character
20
The Evolution of
Programming Languages
Early computers were programmed in
machine language
To calculate wages = rate * hours in
machine language:
100100 010001
//Load
100110 010010
//Multiply
100010 010011
//Store
21
The Evolution of
Programming Languages
(contd.)
rate
hour
wages
22
The Evolution of
Programming Languages
(contd.)
Sample Run:
My first C++ program.
24
25
27
Algorithm:
Programming is a
process of problem
solving
28
Step 3: Maintain
Use and modify the program if the problem
domain changes
29
30
31
32
33
Example 1-1
Design an algorithm to find the perimeter
and area of a rectangle
The perimeter and area of the rectangle
are given by the following formulas:
perimeter = 2 * (length + width)
area = length * width
34
35
Example 1-5
Calculate each students grade
10 students in a class; each student has taken
five tests; each test is worth 100 points
37
38
Programming
Methodologies
Two popular approaches to programming
design
Structured
Object-oriented
40
Structured Programming
Structured design:
Dividing a problem into smaller subproblems
Structured programming:
Implementing a structured design
Object-Oriented
Programming
Object-oriented design (OOD)
Identify components called objects
Determine how objects interact with each other
42
Object-Oriented
Programming (contd.)
An object combines data and operations
on the data into a single unit
A programming language that implements
OOD is called an object-oriented
programming (OOP) language
Must learn how to represent data in
computer memory, how to manipulate
data, and how to implement operations
43
Object-Oriented
Programming (contd.)
Write algorithms and implement them in a
programming language
Use functions to implement algorithms
Learn how to combine data and operations
on the data into a single unit called an
object
C++ was designed to implement OOD
OOD is used with structured design
44
Summary
Computer: electronic device that can
perform arithmetic and logical operations
Computer system has hardware/software
Central processing unit (CPU): brain
Primary storage (MM) is volatile; secondary
storage (e.g., disk) is permanent
Operating system monitors overall activity of
the computer and provides services
Various kinds of languages
46
Summary (contd.)
Compiler: translates high-level language
into machine code
Algorithm: step-by-step problem-solving
process; solution in finite amount of time
Problem-solving process has three steps:
Analyze problem and design an algorithm
Implement the algorithm in code
Maintain the program
47
Summary (contd.)
Structured design:
Problem is divided into smaller subproblems
Each subproblem is solved
Combine solutions to all subproblems
48