Computer programming

Topics: Computer program, Programming language, Computer Pages: 38 (958 words) Published: October 21, 2014
Lecture 1
Introduction to Computers
and C++ Programming

1








What is Computer?
Computer Organization
Computer Languages
C++
Your First Program in C++
Variables and Operators

Computer Programming
(HKU SPACE HDIT 10/11)

2

Computer Programming
(HKU SPACE HDIT 10/11)

3



Computer

◦ Device capable of performing two major functions
1.
2.

Computations
Making logical decisions



Computer programs



Hardware

◦ Sets of instructions used by computers to process data
◦ Various devices comprising computer

 Keyboard, monitor, mouse, disks, DVD-ROM, processing units, etc.



Software

◦ Programs that run on computer, i.e., sets of instructions to command computer to perform actions and make
decisions
◦ Computer programs are subset of software

Computer Programming
(HKU SPACE HDIT 10/11)

4



Six logical units of computer
1. Input unit

 “Receiving” section
 Obtains information from input devices
 Keyboard, mouse, microphone, scanner, networks, etc.

2. Output unit

 “Shipping” section
 Takes information processed by computer
 Places information on output devices
 Screen, printer, networks, etc.
 Information may be used to control other devices
(becomes input of other devices)

Computer Programming
(HKU SPACE HDIT 10/11)

5

3. Memory unit
 “Warehouse” section
 Rapid access, relatively low capacity
 Retains information from input unit
 Immediately available for processing

 Retains processed information
 Until placed on output devices

 E.g., Random Access Memory (RAM)

4. Arithmetic and logic unit (ALU)
 “Manufacturing” section
 Performs arithmetic calculations and logic decisions

Computer Programming
(HKU SPACE HDIT 10/11)

6

5. Central processing unit (CPU)

 “Administrative” section
 Supervises and coordinates other sections of
computer

6. Secondary storage unit

 Long-term, high-capacity “warehouse” section
 Storage

 Inactive programs or data (E.g., document files, game
saves)

 Secondary storage devices

 Harddisks, USB Flash memory

 Longer to access than primary memory
 Less expensive per unit than primary memory

Computer Programming
(HKU SPACE HDIT 10/11)

7






The process of writing instructions to form
programs that are executable by computers
Performed by programmers
Written in various programming
languages
◦ Some are directly understandable by computers
◦ Others require intermediate translation steps

Computer Programming
(HKU SPACE HDIT 10/11)

8

1.

Machine language

◦ The only language computer can understand
◦ “Natural language” of computer
◦ Defined by hardware design
 Machine-dependent

◦ Generally consist of strings of numbers
 Ultimately 0s and 1s

◦ Instruct computers to perform elementary operation
◦ One at a time (E.g., ADD and MOVE)
 Cumbersome for humans

◦ Example,
01001011 10101010 11101010 00011011

Computer Programming
(HKU SPACE HDIT 10/11)

9

2.

Assembly language

◦ English-like abbreviations representing
elementary computer operations
◦ Clearer to humans
◦ Incomprehensible to computers
 Translator programs (assemblers)
 Convert to machine language

◦ Example,

LOAD
ADD
STORE

Computer Programming
(HKU SPACE HDIT 10/11)

BASEPAY
OVERPAY
GROSSPAY

10

3.

High-level languages

◦ Similar to English, use common mathematical
notations
◦ Single statements accomplish substantial tasks
 Assembly language requires many instructions to
accomplish simple tasks of human

◦ Translator programs (compilers)
 Convert to machine language

◦ Interpreter programs

 Directly execute high-level language programs

◦ Example,

grossPay = basePay + overTimePay

Computer Programming
(HKU SPACE HDIT 10/11)

11




A high-level language
Use C++ to study Structured
Programming in this course

◦ Disciplined...
Continue Reading

Please join StudyMode to read the full document

You May Also Find These Documents Helpful

  • Essay about Flowcharts: Computer Programming and Start Statement Block
  • Programming Solutions Essay
  • Request for Proposal Computer Assisted Coding Research Paper
  • Architectural Programming Essay
  • Essay about Integrated Programming Model
  • Essay about Nxt-G Programming Re-Up
  • Computers in the 1950's Essay
  • Essay about Computers Algorithms

Become a StudyMode Member

Sign Up - It's Free