Professional Documents
Culture Documents
Introduction To Computer and Programming
Introduction To Computer and Programming
Programming I
girmay_2008@yahoo.com
Basic Engineering
Computer Programming
Basics of computers
Computer is an electronic device, operating
under the control of instructions called
programs .It is a device which can accept
data, manipulate the data according to
specified rules, produce information from the
processing, and store the results for future
use.
Characteristics of computers
Speed: - computers can calculate at very high
speed. Their speed is measured in milliseconds,
microseconds, nanoseconds
Accuracy: errors in computing (data
processing) is mostly due to human factor
Storage:-can store large amount of data
Versatility: can be programmed and applied
for different purposes
Diligence:-can handle very routine and
repetitive tasks
Information and data processing
Data is a collection of raw facts used to
generate information.
Hence information can be defined as data
that has been transformed into a meaningful
and useful context for specific end users
i.e. It is a refined or processed data.
Cont.
Hence to produce information raw data is
collected, the collected data is processed,
output is produced and the output is
transmitted to concerned users
Data processing has a cycle consists of three
parts
Input -------> Process -----> Output
Computer System
A computer system is composed of the
components that are classified either as
hardware or software.
Computer hardware
Computer hardware is
a physical part of a computer
a part we can see and touch
composed of a number of electronic and
electromechanical parts, which interact with
each other to perform a given task .
the different parts are interrelated by a cable
like device called Bus , which is used to
facilitate communication between parts
Computer is in general does is it takes an input in
various forms, it process the input according to a given
set of instructions and produces an output in various
forms.
The central processing unit (CPU) (microprocessor)
Registers
- They are memories , when an instruction
loaded from memory it is placed first in the
register, to wait signal from the control unit and
data also placed in register prior to execution in
the ALU .
Storage Devices
Storage Devices: there are two types of
storages primary/main storage (memories) and
secondary/Auxiliary storages (memory).
Primary storages are of two types RAM and ROM
Examples:
hard disk drives and floppy disk drives
Microphone
Microphone converts sound into signals that can
be stored, manipulated and played by the
computer.
Output devices
Out put hardware consists of external devices
that used to get information (data) out of a
computer’s CPU to the computer user so that it
can be examined, analyzed, or distributed to
others
These are devices that are used to display the
processed information to the user either in Soft
copy of hard copy
Cont.
- Soft copy: is temporary output such as that
produced by a monitor (unprinted copy /
document)
-Hard copy: permanent output such as that
produced by a printer (printed copy /
document )
-Outputs convert the result of processing to a
form that is easy to understand by human
beings.
-Examples of output devices Monitor (screen),
printers, overhead projectors, (LCD), disk drives
,speakers etc..
Monitor (screen)
- Converts information gathered by then
computer into visual information.
- It looks like a television screen
- Is the most widely used output device
- It displays the output of the processing
activity for the user
- The monitor (screen) attached to the
computer gives the user feedback while the
user types a character from the keyboard
- It is used to display both text and graphics
data
LCD projector
LCD projector is an output device used for displaying
the output of the computer into a large screen, mostly
used in conferences and class room for presentations.
Printer
- Printer produces a permanent hardcopy output from the
computer by converting digital information into marks on
a paper
A printer allows the user to print out on paper a copy
of the screen or the data that is being processed by the
computer
-Printers are available in both color and black and white.
-color printers are slower and more expensive than black
and white printers
Printers can be categorized into impact and non impact
Impact printers
Impact printers are printers which are physically
strike the paper. i.e. the paper and the
characters being printed come in contact with
one another .
Impact printers has hammering parts, hence
printing is noisy.
4 3 -1 6 -4 7
4 3 -1 6 -4 7
7 2 -1 8 10 8 Sn=11
Expressing Algorithm
There are two ways by which you can express or
describe your algorithm.
A. Using Pseudo code
An algorithm is a procedure for solving a
problem in terms of the actions to be executed
and the order in which those actions are to be
executed.
An algorithm is merely the sequence of steps
taken to solve a problem. The steps are
normally "sequence," "selection,” "iteration,"
and a case-type statement.
Pseudocode is an artificial and informal
language that helps programmers develops
algorithms. Pseudocode is a "text-based" detail
(algorithmic) design tool.
Read X, Y, Z
Compute Sum (S) as X + Y + Z
Compute Average (A) as S / 3
Compute Product (P) as X * Y * Z
Write (Display) the Sum, Average and Product
Examples:
3. a program that reads two numbers and
displays the numbers read in decreasing order:
Read A, B
If A is less than B
BIG = B
SMALL = A
else
BIG = A
SMALL = B
Write (Display) BIG, SMALL
B. Using Flowchart
Flowchart is a diagrammatic representation of
an algorithm. Flowchart is very helpful in
writing program and explaining program to
others.