Introduction to Computer System C++
Programming
____________________________________________________________________________________________
CHAPTER 1 INTRODUCTION TO COMPUTER SYSTEM
1.1 Introduction what is a computer system
The main elements of a computer system are involved as the following:
People
Procedures
Peripheral equipment or hardware devices
Software
Data
Under computer programming, software is the most related component because it
refers to a set of instructions or program that written by the programmer.
Software can be divided into two parts:
Application software
Developed for general purpose such as by using Microsoft Office Software,
the students can use MSWord to prepare their assignment etc. Besides that it
is also can be developed for special purpose based on client request for
example ISIS, ICRESS that developed for UiTM
System software
Usually refer to software that already installed by the manufacturer while
buying the PC. Besides that, the user can also install this software to upgrade
their computer system etc. Commonly there are four types of system
software: operating system, utility program, user interfaces and language
translators.
1.1.1 Operating system or supervisory program
Refer to software that written into memory upon startup of computer. It instructs the
computer to “watch for” and respond to message given to it from the keyboard mouse
or other input device. It can be used by multiple user or single user. The example of
common OS:
- UNIX / LINUX for multiple user usually for workstation
- MS Windows for single user, the most common OS that widely use nowadays
in PC
- Macintosh OS for single user for Macintosh computer
- MSDOS for single user
1.1.2 Utility Programs
The software used for managing disk drives, printers or other devices. Perform the
basic operations necessary for the fundamental performance of the computer system
such as creating, copying, saving, deleting, merging and sorting files for example
editors that enables user to create and modify the contents of a text file.
_____________________________________________________________________
1
Fakulti Sains Komputer dan Matematik
Universiti Teknologi Mara, 40450, Shah Alam, Selangor
Introduction to Computer System C++
Programming
____________________________________________________________________________________________
1.1.3 User Interface
Interact with the software using visual images such as icons. Some tasks performed
by this type of software:
- validating user id and account number
- allocating memory and processor time
- making the editor, compiler, linker and loader programs as well as entire
libraries of other programs available to user
1.1.4 Language translators
Convert programmer made instructions into machine language instructions or object
code. 3 types of language translator:
- Assemblers that convert programs written in assembly language to object
code
- Interpreters that is used for high level language. It translates and executes
one after another, and takes an instruction, converts it to machine language
and executes it.
- Compiler that takes an entire program written in high level language and
convert it to machine language.
1.2 Computer Programming
Computer programming language is an artificial language invented to allow humans
to instruct the computers on how to execute the task based on algorithms design.
The process of writing those instructions is called programming.
Every program is can be written in some programming language. Computers only
understand binary codes that are 1 and 0 digit only, so the first programs were written
using these binary codes. This form of programming was soon seen to be extremely
complex and error prone, so Assembler Language were developed. Soon it was
realized that even Assembler Language also could be improved on.
1.2.1 Computer Programming Language Generation
Low level language
1st GL : Machine Language
2nd GL: Assembler Language: The structure of the language reflects the
instruction of set ( architecture ) of the CPU.
* Low level languages allow efficient use of the machine but are difficult to
use
High level language
3rd GL: Procedure Oriented: COBOL, PASCAL, C++, FORTRAN, JAVA
4th GL: Problem Oriented / Query: DATA-TRIEVE, INTELLECT
Very high level language
_____________________________________________________________________
2
Fakulti Sains Komputer dan Matematik
Universiti Teknologi Mara, 40450, Shah Alam, Selangor
Introduction to Computer System C++
Programming
____________________________________________________________________________________________
A very high-level programming language (VHLL) is a programming language with
a very high level of abstraction, used primarily as a professional programmer
productivity tool.
Very high-level programming languages are usually limited to a very specific
application, purpose, or type of task. Due to this limitation in scope, they might use
syntax that is never used in other programming languages, such as direct English
syntax. For this reason, very high-level programming languages are often referred to
as goal-oriented programming languages.
Some high-level programming languages such as Python, Ruby, and Scheme
are often considered to be VHLL.[1]
([Link]
1.3 Program Development Life Cycle
In developing a software application, the programmer needs to have an organized
plan or methodology that breaks the process into a series of tasks before start writing
the programming code or source code. These different methodologies, tend to be
variations of what is called the program development life cycle (PDLC).
PDLC is an outline of each of the steps used to build software applications. The
PDLC consist of the following steps:
Analyze the problem
Design the program
Implementation (Coding)
Testing and debugging
Maintainance
Analyze the problem
where the problem that need to be solved is precisely define the input,
process and output that are be used in the program
Design the program
by developing a detailed logic plan using a tool such as pseudo code,
flowcharts, object structure diagrams or event diagrams to group the
program’s activities into modules.
Pseudocode (derived from pseudo and code) is a compact and informal
high-level description of a computer programming algorithm that uses the
structural conventions of some programming language,
([Link]
_____________________________________________________________________
3
Fakulti Sains Komputer dan Matematik
Universiti Teknologi Mara, 40450, Shah Alam, Selangor
Introduction to Computer System C++
Programming
____________________________________________________________________________________________
Flowcharts use the graphicfal symbol to represent the process. Some of the
common symbols and the purpose that may use can be described as below
Process
Input / Ouput
Flowline
Decision
Termination
Connector
Implementation
Translate the design into an application using a programming language or
application development tool by creating the user interface and writing code.
The format of coding depends on the programming language chosen
The syntax of coding will be discussed in Chapter 2 onwards
Testing and debugging
The coding will be tested using a few sample of data in order to check the
flexibility of the program and also its fulfill the requirement needed in the early
stage
Debugging I the process of looking and correcting errors or mistakes that
cause the programs to behave unexpectedly. 3 types of errors: syntax,
runtime and logic error
Maintainance
Maintaining the program so it can be upgraded for future use
_____________________________________________________________________
4
Fakulti Sains Komputer dan Matematik
Universiti Teknologi Mara, 40450, Shah Alam, Selangor
Introduction to Computer System C++
Programming
____________________________________________________________________________________________
Example 1
Problem: to find the average of 3 integers
Step 1: Analysis
Input : list the data involve - num1, num2, num3
Process : determine the formula
Average = (num1 + num2 + num3)/3
Output : Average
Step 2: Design
Pseudocode
Begin
Input 3 data: num1, num2 and num3
Calculate the average -> average = (num1 + num2 + num3)/3
Display the result: -> average
End
Flowchart
Begin
Num1,
num2, num3
average = (num1 + num2 + num3)/3
average
End
_____________________________________________________________________
5
Fakulti Sains Komputer dan Matematik
Universiti Teknologi Mara, 40450, Shah Alam, Selangor
Introduction to Computer System C++
Programming
____________________________________________________________________________________________
Exercises
1. Differentiate between low-level and high-level language.
2. What is a debugging process?
3. Briefly describe the design phase and integration phase in problem solving
methodology?
4. What is the function of assembler and interpreter in a computer system?
5. Write an analysis and pseudo code that can calculate the area of a rectangle
6. Draw a flowchart that can show the process how to calculate the volume of a sphere.
_____________________________________________________________________
6
Fakulti Sains Komputer dan Matematik
Universiti Teknologi Mara, 40450, Shah Alam, Selangor