Introduction To Computer Systems, Programming Languages and Programming
Introduction To Computer Systems, Programming Languages and Programming
5
6
Input Devices
Control Unit
Retrieves and decodes program instructions
Coordinates activities of all other parts of computer
11
12
Main Memory
It is volatile. The program that is being executed is kept in
main memory.
Main memory is erased when program terminates or
computer is turned off
Also called Random Access Memory (RAM)
Organized as follows:
bit: smallest piece of memory. Has values 0 (off,
false) or 1 (on, true)
byte: 8 consecutive bits. Bytes have addresses.
13
Main Memory
Above figure, the number 149 is stored in the byte with the address 16, and
the number 72 is stored at address 23.
14
Secondary Storage
Non-volatile: data retained when program is not running
or computer is turned off
Categories of software:
Operating system: programs that manage the
computer hardware and the programs that run on
them. Examples: Windows, UNIX, Linux
19
Computer Languages
To write a program for a computer, we must use a computer
language.
BUT,
What is a Computer Language?
What makes a computer language?
Why do computers have them?
Why are there so many different computer languages?
20
History of Programming Language
Computers are electronic, and they are digital.
No voltage means a zero to the electronic devices (e.g.
computers), and have voltage means a one.
21
Computer Language Evolution 22
Note
The only language understood by computer
hardware is machine language.
23
Machine Language
1011010000000101
24
The Multiplication Program in Machine Language
25
Also called as assembly language
27
The Multiplication Program in Symbolic Language
28
Computer Language Evolution 29
Note
High-level languages are codes similar to everyday English and uses mathematical
notations
Example: grossPay = basePay + overTimePay
30
The Multiplication Program in C++
31
Types of Programming Languages
Low-level:
used for communication with computer
hardware directly. Often written in binary
machine code (0s/1s) directly.
32
Some Well-Known Programming Languages
C++
BASIC Ruby
Java
Visual Basic
COBOL C#
JavaScript
C Python 33
The program which is using the second and third generation languages
for writing will use a compiler to turns it into machine code.
Source Code
Machine
In 2nd / 3rd Compiler
Language
language
34
From a High-level Program to an
Executable File
a) Create file containing the program with a text editor.
b) Run preprocessor to convert source file directives to source
code program statements.
c) Run compiler to convert source program into machine
instructions.
d) Run linker to connect hardware-specific code to machine
instructions, producing an executable file.
Steps bd are often performed by a single command or button
click.
Errors detected at any step will prevent execution of following
steps.
35
Source Code Object Code
Preprocessor Linker
Compiler
36
The Programming Process
37
PROBLEM
Analyse the problem
C++ Program
38
Example of C++ Program
39
Summary of Chapter 1:
A computer is a system made of two major components:
hardware and software.
41