Professional Documents
Culture Documents
and Methodology
COMP104: Introduction
Dr. Brian Mak
Dr. Pedro Sander
Dr. Zhen Zhou
Department of Computer Science & Engineering
The Hong Kong University of Science and Technology
Hong Kong SAR, China
Fall 2007
p.1
Part I
Computer, Computer Program, and Programming
Languages
p.2
Course Objectives
p.3
p.4
work
WORKER
output
HUMAN
INSTRUCTIONS
work
COMPUTER
output
PROGRAM
p.5
Memory
results of operations
instructions/data
CPU
ALU
Control
Unit
I/O devices
p.6
Is This a Computer?
p.7
p.8
p.9
p.10
#include <stdio.h>
int main()
{
int x, y, z;
x = 1;
y = 2;
z = x+y;
return 0;
}
p.11
p.12
p.13
source code
machine A compiler
compile
static codes
compile once, run many
machine A code
optimized codes
more efficient
examples: FORTRAN,
Pascal, C++
{ mak, psander, cszz } cse.ust.hk
run
output
p.14
Part II
Problem Solving and Computer Programming
p.15
p.16
p.17
p.18
p.19
p.20
8
2
4
C
3
1
B
p.21
A
8
D
7
4
C
3
1
B
E
9
p.22
Problem Solving
Define the problem.
Be specific
What are the input(s) and output(s)?
Any constraints?
Which information is essential?
Develop a solution.
Outline the solution first.
Write down the details step-by-step.
p.23
Develop a solution.
Construct an algorithm.
Implement the algorithm by writing a program.
p.24