CHAPTER 5
PROGRAMMIN
G
5.1
Basic Programming Concepts
THE DEFINITION OF PROGRAM
A computer program is a set of instructions given
to the computer to perform any task.
THE DEFINITION OF
PROGRAMMING LANGUAGE
A programming language is a set of words,
symbols and codes that enables human to
communicate with computers.
Words (Dim, If, Then,
For, Next)
Dim number1 as Integer
Dim number2 as Integer
Symbol (=, +, -, *, /)
number1 = 10
number2 = 20
code
s If total = number1 + number2
Then
Print Excellent
Else
Print Please try again
End If
LEVELS AND GENERATIONS OF
PROGRAMMING LANGUAGES
Low-level Programming Language
High-level programming Language
LEVELS AND GENERATIONS OF
PROGRAMMING LANGUAGES
Low-level programming
languages
First Generation Second
Machine Generation
Language Assembly
Language
FIRST GENERATION:
(MACHINE LANGUAGE)
Language that computers can execute directly.
Instructions in this language are in the form of
binary digits 1s and 0s.
Examples : Machine Language
101000010011001101 Statement for adding two
numbers.
101000100011001101 Statement for subtracting
two numbers.
SECOND GENERATION
(ASSEMBLY LANGUAGE):
Uses symbolic instructions (mnemonics) to
represent the instructions in the programs.
Examples : AUTOCODER, SAP and SPS
ADD R1 R2 Adds two numbers stored in registers
R1 and R2.
SUB R1 R2 Is the instruction to subtract two
numbers stored in the registers R1 and R2.
HIGH-LEVEL PROGRAMMING
LANGUAGE
High-level
programming
languages
Third Forth Fifth
Generation Generation Generation
COBOL, BASIC, SQL, Prolog and
C, ADA NOMAD, Mercury
FOCUS,
Intellect
THIRD GENERATION
Uses a series of English words and mathematical
symbols for writing programs to write
instructions.
Example: COBOL, BASIC, C and ADA
FORTH GENERATION
A very high-level programming language
Non-procedural language enables users to access
data in a database.
Example: SQL
FIFTH GENERATION
Visual programming language (natural
language).
Provides a visual or graphical interface, called a
visual programming environment, for creating
source codes.
Example: Prolog and Mercury