Escolar Documentos
Profissional Documentos
Cultura Documentos
Programming Fundamentals
Chapter 1
Programming Fundamentals
Computer Hardware
Input unit
Output unit
Memory unit
ALU
CPU
Secondary storage
Programming Fundamentals
Input Unit
- It obtains information from various input devices and
places this information at the disposal of the other units.
- Examples of input devices: keyboards, mouse devices.
Output Unit
- It takes information that has been processed by the
computer and places it on various output devices.
- Most output from computer is displayed on screens, printed
on paper, or used to control other devices.
Programming Fundamentals
Memory Unit
Programming Fundamentals
CPU
The unit supervises the overall operation of the
computer.
Programming Fundamentals
Secondary Storage
Programming Fundamentals
Some terminology
Machine languages
Example:
00101010 000000000001 000000000010
10011001 000000000010 000000000011
opcode
address parts
Programming Fundamentals
Programming Fundamentals
10
Assembly languages
Programming Fundamentals
11
Assembler
Assembly
language
program
Translation
program
(assembler)
Programming Fundamentals
Machine
language
program
12
Programming Fundamentals
13
Example:
Programming Fundamentals
14
Programming Fundamentals
15
Programming Fundamentals
16
PROGRAMMING LANGUAGES
1957
1960s
1960s
1971 Structure programming
Object-oriented programming
What is Syntax?
A programming languages syntax is the set of rules for writing
correct language statements.
Programming Fundamentals
17
18
19
Structured Programming
Programming Fundamentals
20
Programming Fundamentals
21
22
23
2. Develop a Solution
We develop an algorithm to solve the problem.
Algorithm is a sequence of steps that describes how the data are to
be processed to produce the desired outputs.
Programming Fundamentals
24
Program description
Algorithm development and changes
Well-commented program listing
Sample test runs
Users manual
Programming Fundamentals
25
Programming Fundamentals
26
ALGORITHMS
Programming Fundamentals
27
Flowchart symbols
Terminal
Input/output
Process
Flowlines
Decision
Programming Fundamentals
28
Example
Start
Input Name,
Hours, Rate
Calculate
Pay Hours Rate
Dislay
Name, Pay
End
Programming Fundamentals
29
Algorithms in pseudo-code
Example:
Input the three values into the variables Name,
Hours, Rate.
Calculate
Pay = Hours Rate.
Display Name and Pay.
Programming Fundamentals
30
Loops
Note:
1. Loop is a very important
concept in programming.
Start
NUM 4
SQNUM NUM2
Print
NUM, SQNUM
NUM NUM + 1
do
SQNUM NUM2
No
NUM> 9?
Yes
STOP
Programming Fundamentals
31