1 Chapter 1 - Intro To Computer - Programming
1 Chapter 1 - Intro To Computer - Programming
Introduction to Computer
and Programming
2
Objectives :
A brief history of computer and
programming
Introduction to programming
Programming paradigm
Introduction to C++
3
History of computer
History of computer
History of computer
History of computer
History of computer
History of computer
History of computer
History of computer
History of computer
History of computer
History of computer
Definition of Computer
Computer – an electronic devices consist of
hardware and software and perform tasks and
produce the output
Hardware - physical components that
constitute a computer system
Software – programs written to perform
specific tasks
16
Hardware
17
Software
System Software
• Operating system
• Utility program
Application Software
19
Introduction to programming
A set of rules, words and symbols are used to
write a computer program – telling a
computer what to do.
The source codes (program) are compiled and the
executable files (*.exe) are produced.
program1
Error free
Compiled Executable
Programmer file (*.exe)
writes program & debug
20
Generation of Programming
language
Machine language
Assembly language
High Level language
Compiler
machine language program
Computers understand
People understand
binary(11011)
‘program’
22
Machine Language
Binary number codes understood by a specific CPU.
Lowest level of language
Represent data and program instructions as 1s and 0s
The only language that computer directly understand
(Do not require translator)
Not convenient to read and use.
First generation language
Machine - dependent
Example:
To calculate wages = rates * hours in machine
language:
100100 010001 //Load
100110 010010 //Multiply
100010 010011 //Store
23
Assembly Language
Second generation language
Developed to replace 1s and 0s use in machine
language.
Use mnemonic codes : abbreviations that easy to
remember
Requires a translator to translate the assembly program
into machine language ( assembler).
Difficult to learn
Machine-dependent
A for Add
C for Compare
MP for Multiply
24
Comparison
A Machine-language Program Fragment and Its
Assembly-Language Equivalent
Memory Address Machine-Language Assembly-Language
Instructions Instructions
Computer
language
evolution
Examples :
To calculate the wages = rates * hours
• Machine language
100100 010001 //Load
100110 010010 //Multiply
100010 010011 //Store
• Assembly language
LOAD rate
MULT hour
STOR wages
Language Translator
Program need to translate because computer only
understand machine language
Assembler
Used in assembly language for translate the language
to machine language
Interpreter
Translates one program code statement at a time.
Immediately displays feedback when it finds error.
Compiler
Translating the source code from its original language
into machine code.
Converts the entire source program into machine
language at one time
32
Programming Paradigm
Procedural paradigm
Object-Oriented Paradigm
Introduction to C++
Is a structured or procedural
programming and the object oriented
programming
High level language
Is a case sensitive language
Developed by Bjarne Stroustrup at Bell
Labs
36
Source
code
Output
37
High Level
Language to
Machine
Language
(Executable file)
Programmer
Code
Code
Executable Code
40
Integrated Development
Environments (IDEs)
An integrated development environment, or IDE,
combine all the tools needed to write, compile, and
debug a program into a single software
application.
Examples are Dev C++, Code Blocks, Microsoft
Visual C, Borland C Builder, CodeWarrior, etc.
41
Dev C++
42
CppDroid