Professional Documents
Culture Documents
FUNDAMENTALS OF
COMPUTER PROBLEM SOLVING
Topic 1:
Introduction
Topic Covered
Introduction to Programming
Definition of computer and computer program
Introduction to Programming
Introduction to computer
o Hardware
o Device that processes data to create information (ex: input,
output, storage and processing devices)
o Software
o Step-by-step instructions that tell the computer how to do its
work.
o It is also called a program.
o It’s purpose to convert data to useful information
Elements of a computer program (cont.)
SOFTWARE
SYSTEM SOFTWARE
• provides an environment for user
to execute the application software. APPLICATION SOFTWARE
•Enables the application software
to interact with computer • end user software.
hardware. •A program that performs a
•Eg. Operating System common task to the user.
•Eg. Word, Excel.
Elements of a computer program (cont.)
Computer Program
o 1st generation
o Machine Language is the basic language of the computer,
representing data as 1’s and 0’s.
o 2nd generation
o Assembly language (low-level language) that allows a computer user
to write a program using simple word instead of numbers.
o 3rd generation
o High-level language resembles some human language (English) –
eg. COBOL, FORTRAN, BASIC.
o Very high-level language, much more user-oriented and allow
users to develop programs with fewer commands compared with
procedural languages – eg. SQL, NOMAD
o Natural Language uses human language to give people a more
natural connection with computers.
Elements of a computer program (cont.)
STORAGE
•Store the data or information for
future use (permanently or
INPUT temporarily)
•E.g. Hard disk, memory
•Whatever data that is PROCESSING
inserted into a computer
using input devices •Convert input data into
•E.g. Mouse, keyboard information.
•E.g. CPU OUTPUT
•Generate the useful
information using output
devices
•E.g. Monitor, printer
The Importance of Programming
Reliability of Output
Good program should produce correct output
During testing phase different set of input data is used to ensure the
reliability of output
Program’s Efficiency
Good program should be reliable and efficient in the sense that it is
produces no errors during execution process
Program must achieve its purpose so that the final result can be
trusted
Use of pseudocode or flowchart to outline the program
The Importance of Good Programs (cont.)
Interactivity
Interaction between user and the program is well defined
Interactivity is important so that the user knows the
processing status
User-friendly programs allow user to respond to the
instructions correctly and allow them key in valid input
Program readability
Readability is concerned with how other person views one’s
program
Use of indention and comment increase the level of
readability
The Importance of Good Programs (cont.)
Block Comment
Begin with the symbol /* and end with the symbol */
Use for statements that span across two or more lines
Ex: /* This program calculates the salary of employees */
Language Translator
INTERPRETER
ASSEMBLER COMPILER
• a program that • a program that translates • a program that translates
translates the assembly high-level language into source code of high-level
language program into machine language. language into machine
machine language. •Translate the source code language.
once and saves to be reused. •Each instruction is
•Requires less memory and interpreted into machine
runs faster. language.
•Eg. PASCAL, C++, COBOL •Program is easier to develop.
•Eg. BASIC.
Program Translator (cont.)
Syntax errors
Syntax error is an error in the structure or spelling of a statement
Can be detected by compiler
Example
1 cout << “/n There are five syntax errors”
2 cot >> “Correct Them;
Logic errors
Refer to unexpected or unintentional errors resulted from
some flaw in the program’s logic
Compiler cannot detect logic error
Some indication of logic errors
No output
Unappealing or misaligned output
Incorrect numerical results
Premature program termination
Program Errors (cont.)
Pseudocode
Expresses an algorithm in everyday English rather than
programming language.
Describe instructions in your own word
2. Algorithm Design (cont.)
Example
Start
Input num1,
num2,num3
End
3. Algorithm Implementation/ Coding
Maintenance
Any activities to keep the program in good working
condition, error free and up-to-date.
Involves any amendments, additional coding or repairs to
the programs.
Documentation
Written description of a program, what it does and how to
use.
Purpose for reference to other programmers if any
maintenance to be taken.
Try Yourself 2
END