Professional Documents
Culture Documents
WHAT IS A COMPUTER?
Hardware
Software
Peopleware
Dataware
COMPONENTS OF A CPU
MAIN MEMORY
Bit
Hardware
The Nuts and Bolts of the Machine
Byte
Is 8 consecutive bits
SECONDARY STORAGE
OUPUT DEVICES
Central
Output
Input
Processing
Main
Device Unit Device
Memory
Secondary
Storage
Devices
PEOPLEWARE
Software
Bringing the Machine to Life
System software
Application software
Operating Systems
Compilers
System Utilities
Programming Language
DATAWARE
Types of Programming
Languages
Machine Languages
Assembly Languages
High-level Languages
MACHINE LANGUAGES
ASSEMBLY LANGUAGES
Processing a High-Level
Language Program
Compiling
Linking
Executing
HIGH-LEVEL LANGUAGES
EDITING
COMPILING
LINKING
EXECUTABLE FILES
Algorithm and
Flowcharting
COMPUTER PROGRAM
A set of detailed, step-by-step
instructions that directs the computer
what you want it to do.
Programs are written in a programming
language - which is a set of rules that
provides a way of telling the computer
what operations to perform.
The person who creates computer
program is called computer programmer.
STEPS IN PROGRAMMING
Understand the problem
Plan the logic
Code the program
Compile the program into machine
language
ALGORITHM
A sequence of well-understood steps for
a person to follow in order to accomplish
a certain task or to solve a particular
problem.
It is a finite set of instructions that
specify a sequence of operations to be
carried out in order to solve a specific
problem or class of problems.
Examples:
directions for going to a certain place
baking a chocolate cake
computing income tax
searching for a name in a telephone directory
CHARACTERISTICS OF ALGORITHMS
Specify each step or instruction
exactly.
The instructions must be clear.
6
PSEUDOCODE
FLOWCHARTS
A graphical representation of the logical
steps that solves a problem.
A diagram representing the logical
sequence in which a combination of
steps or operation is to be performed. It
is a blueprint of the program.
Programmers use flowcharts to
understand the logic processing of data.
Although time consuming, its the best
tool for beginners.
BASIC FLOWCHARTING SYMBOLS
Termi
Proce
nal
Input/
ss
block
Decis
Outp
symb
ion
ut
ol
symb
block
ol
OnOffpage
Initiali
page
Conn
Flow
zatio
Conn
ector
lines
n
ector
symb
ol
Terminal (OVAL)
- used to signify the beginning and end of
flowchart
Initialization (HEXAGON)
- signifies the initialization or preparation of
data.
-
Input/Output (PARALLELOGRAM)
- shows input and output.
Data are to be read into the computer
memory from an input device or data are to
7
Names cannot contain spaces.
SEQUENCE STRUCTURE
Directs the computer to process the
program instructions, one after another,
in the order listed in the program.
Series of actions are performed in
sequence
DECISION STRUCTURE
Makes a decision and then takes an
appropriate action based on that
decision
Example: waiting or crossing at railroad
tracks depending on signal lights
REPETITION STRUCTURE
A repetition structure represents part of
the program that repeats. This type of
structure is commonly known as a loop.
CASE STRUCTURE
One of several possible actions is taken,
depending on the contents of a variable.
Pseudocode
8
Editing the program- You write a
program with words or symbols that are
understandable to human beings.
-
C++ Keywords
Keywords are predefined reserved words
or reserved identifiers that have special
meanings.
-
10
Pair with extraction operator (>>) takes information from the keyboard
to a variable and stores it in internal
memory
Program Layout
Compiler accepts almost any pattern
of line
breaks and indentation
Programmers format programs so
they
are easy to read
11
Comment
is simply a message to the
person reading that program
and is referred to as internal
documentation
Begin with // (two forward
slashes) before the text you
want treated as a comment
through the end of the line.
Ex: // This is a sample C++
program.
Comment
Comments can span multiple
lines
Begin with /* and end with */
Ex:
/*---------------------------Multi-line C++ style comment
----------------------------*/
Program comments may be
used anywhere in the program,
and are ignored by the
compiler.
12
Logic Errors
-Errors in the programs algorithm
-Most difficult to diagnose
- Compiler does not recognize an error
Bug- A mistake in a program