Chapter 01
Chapter 01
INTRODUCTION TO PROGRAMMING
CONTENTS
COMPUTER PROGRAMMING
CONCEPTS
PROBLEM SOLVING
OVERVIEW
ALGORITHM OVERVIEW
(PSEUDOCODE &
FLOWCHART)
What is Computer Programming?
http://jacobian.web.id/2010/11/14/java-and-c-top-programming-language-rank/
History of Programming
History of Programming
History of Programming
History of Programming
History of Programming
History of Programming
History of Programming
Software
15
Operating systems
Spreadsheets
Binary code:
A sequence of 0s and 1s
Byte:
A sequence of eight bits
16
Assembly Language
17
Sample Run:
???
19
Processing a C++ Program
(continued)
To process a program written in C++:
Use an editor (IDE) to create a source
program in C++
Use the compiler to:
20
Programming Methodologies
Object-oriented
21
What is Problem Solving ?
The process of working through details of a
problem to reach a solution.
Pseudocode:
Begin
1. PROMPT user for the first number
2. READ user's first integer input (N1)
3. PROMPT user for thesecond number
4. READ user's second integer input (N2)
5. ADD first integer and second integer into sum
(SUM=N1+N2)
6. DISPLAY the result (SUM)
END
Flowchart
Terminal Symbol
Indicates the starting or stopping point
in the logic. Every flowchart should
begin and end with a terminal symbol.
Process Symbol
Represents any single process in an
algorithm, such as assigning a value or
performing a calculation
Decision Symbol
Represents a decision in the logic
involving the comparison of two values.
Alternative paths are followed,
depending on whether the decision
symbol is true or false
Flowlines
Connect various symbols in a
flowchart, and contain an arrowhead
only when the flow control is not from
top to bottom or left to right
Guidelines for Drawing a
Flowchart
The following are some guidelines in
flowcharting:
1. All necessary requirements should be listed
out in logical order.
2. The flowchart should be clear, neat and easy
to follow.
3. The usual direction of the flow of a procedure
or system is from left to right or top to
bottom.
Guidelines for Drawing a
Flowchart (Cont.)
X=9 TRUE
9
FALSE
Guidelines for Drawing a
Flowchart (Cont.)
START
END
Sample Pseudocode &
Flowchart
Begin
Input letter
If letter is ‘M’
Display
‘Malaysian’
Else
Display
‘Foreigner’
End
End
Exercise
Flowchart
????
Exercise
Flowchart
????
Exercise
Flowchart
Exercise