Professional Documents
Culture Documents
LECTURE 1
INTRODUCTION
•What is a computer ?
A computer is a programmable machine. This means it can execute a programmed list of instructions and
respond to new instructions that it is given.
•Because programs are not written in 1s and 0s, the computer must first translate the program
before it can be executed.
READ num1
READ num2
LOAD num1
Example of Second Generation ADD num2
Language STORE sum
PRINT sum
STOP
Third Generation Languages
•Third Generation (People-Oriented Programs)
•Instructions in these languages are called statements.
•High-level languages: Use statements that resemble English phrases combined with
mathematical terms needed to express the problem or task being programmed.
•Transportable: NOT-Hardware dependent.
•Because programs are not written in 1s and 0s, the computer must first translate the program
before it can be executed.
•Instructions are closer to English and included simple mathematical notation.
Third Generation Languages
Program sum2(input,output);
var
num1,num2,sum : integer;
begin
Example of Third Generation
Language read(num1,num2);
sum:=num1+num2;
writeln(sum)
end.
Fourth Generation Languages
•Fourth Generation - Non-Procedural Languages
•Programming-like systems aimed at simplifying the programmers task of imparting instructions
to a computer.
•These require fewer instructions to accomplish a task than third generation languages.
•Many are associated with specific application packages.
◦ Query Languages
◦ Report Writers
◦ Application Generators
◦ Form Designers
Fifth Generation Languages
•Fifth Generation - Natural Languages
•Natural-Language: Languages that use ordinary conversation in one’s own language.
•Research and experimentation toward this goal is being done.
• Intelligent compilers are now being developed to translate natural language (spoken) programs into
structured machine-coded instructions that can be executed by computers.
• Effortless, error-free natural language programs are still some distance into the future.
Testing and
Developing Writing the Documenting
debugging the
the algorithm program. the program
program
Building a Program
I. Developing the algorithm.
• Algorithm: A detailed description of the exact methods used for solving a particular problem.
• Flowchart is an organized combination of shapes, lines, and text that graphically illustrates a
process or structure.
• It visually represents and organizes the steps used to write the program—it is a diagram of
the “flow” of the process.
Flowchart Symbols
Flowchart Symbols
Pseudocode
•Pseudocode uses English-like phrases to outline the task/process
•One of the popular representation of Algorithm
•Widely choosen because:
◦ easy to read and write
◦ allow the programmer to concentrate on the logic of the problem
◦ Structured in English language
Pseudocode Convention
•Statement are written in simple English
•Each instruction is written on a separate line
•Keywords and indentation are used to signify particular control
structures.
•Each set of instructions is written from top to bottom, with only one
entry and one exit.
•Groups of statements may be formed into modules, and that group
given a name.
Six Basic Computer Operations
1. A computer can receive information
Verb used:
•Read used when the algorithm is to receive the input from a record on a file
•Get used when the algorithm is to receive input from the keyboard.
IF student_attendance_status is part_time
THEN
add 1 to part_time_count
ELSE
Add 1 to full_time_count
ENDIF
Six Basic Computer Operations
6. A computer can repeat a group of actions
Keyword used:
DOWHILE, ENDDO