Professional Documents
Culture Documents
FUNDAMENTALS OF
COMPUTER PROBLEM SOLVING
Topic 1
Introduction
Topic Covered
⚫ Introduction to Programming
⚪ Definition of computer and computer program
⚪ Importance of computer programming
⚪ Importance of good programs.
Introduction to Programming
Introduction to computer
SOFTWARE
SYSTEM
SOFTWARE APPLICATION
SOFTWARE
Computer Program
1st generation
2nd generation
3rd generation
□ High-level language resembles some human language (English) –
eg. COBOL, FORTRAN, BASIC.
□ Very high-level language, much more user-oriented and allow
users to develop programs with fewer commands compared with
procedural languages – eg. SQL, NOMAD
□ Natural Language uses human language to give people a more
natural connection with computers.
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.)
4
Program readability - Comments
⚪ Help a human reader to understand the program
⚪ Can be placed anywhere within a program
⚪ Will not be executed by compiler
⚪ C++ supports two types of comments
Line Comment
Block Comment
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
Example: /* This program calculates the salary of employees */
Language Translator
Assembler Interpreter
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
Input num1,
num2,num3
Display the
Average
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