Vous êtes sur la page 1sur 42

Problem solving using

Computers

Introduction to computers
Algorithms & Flowcharts
C++ Fundamentals
Operators and Expressions
Flow of control
Derived Data types
Functions
Object oriented Programming Concepts
Dept. of CSE

References:

Programming in ANSI C, 2nd Edition, - E. Balaguruswamy,


TataMcGraw Hill

Object Oriented Programming with C++, 2nd edition, -E.


Balaguruswamy, TataMcGraw Hill
C++:The Complete Reference 4th edition Herbert Schildt,
Tata McGrawHill.
Object Oriented Programming with Turbo C++ - Robert
Lafore, Gagotia Publications, 2002

Dept. of CSE

Mode of evaluation
Sum of best two of three tests
20 +20 = 40 marks
Sum of best two of three
Assignments/quizzes/open book tests
5 + 5=10 marks
Total 50 marks

Dept. of CSE

What Is A Computer?
A computer is an electronic device,
operating under the control of
instructions (software) stored in its own
memory unit, that can accept data
(input), manipulate data (process), and
produce information (output) from the
processing.
Generally, the term is used to describe
a collection of devices that function
together as a system.

Devices that comprise a computer system

Monitor
(output
)

Speake
r
(output
)

Printer
(output
)

System unit
(processor,
memory)

Storage devices
(CD-RW, Floppy,
Hard disk, zip,)
Scanne
r
(input)

Mouse
(input)
Keyboard
(input)

Dept. of CSE

What Does A Computer Do?


Computers can perform four general
operations, which comprise the information
processing cycle.
Input
Process
Output
Storage

Data and Information


All computer processing requires data, which is a
collection of raw facts, figures and symbols, such as
numbers, words, images, video and sound, given to
the computer during the input phase.
Computers manipulate data to create information.
Information is data that is organized, meaningful,
and useful.
During the output Phase, the information that has
been created is put into some form, such as a printed
report.
The information can also be put in computer storage
for future use.
Dept. of CSE

Why Is A Computer So Powerful?


The ability to perform the information
processing cycle with amazing speed.
Reliability (low failure rate).
Accuracy.
Ability to store huge amount of data and
information.
Ability to communicate with other computers.

Dept. of CSE

How Does a Computer Know


what to do?
It must be given a detailed list of instructions,
called a compute program or software, that
tells it exactly what to do.
Before processing a specific job, the computer
program corresponding to that job must be
stored in memory.
Once the program is stored in memory the
computer can start the operation by executing
the program instructions one after the other.
Dept. of CSE

Block Diagram of Computer


Central Processing
unit
Input Device

Output Device

Arithmetic Logic
Unit

Control unit

Auxiliary storage
Device

Primary storage

Dept. of CSE

10

Input Devices
The input device is usually a keyboard where programs
and data are entered into the computer.
Examples of other input devices include

Mouse
Joystick
Light pen
Trackball
Optical Scanner
Touch screen
Voice input
Dept. of CSE

11

The Keyboard

The most commonly used input device is the


keyboard on which data is entered by
manually keying in or typing certain keys. A
keyboard typically has 101 or 105 keys.

The Mouse

Is a pointing device which is used to control


the movement of a mouse pointer on the
screen to make selections from the screen. A
mouse has one to five buttons. The bottom of
the mouse is flat and contains a mechanism
that detects movement of the mouse.

System Unit
Data and instructions received from the input device are
stored and processed in the System unit. The Central
Processing Unit and Memory Unit are together called as
System Unit.

Dept. of CSE

14

The Central processing Unit


The data and instructions received from the
input device are processed in this unit.
It is considered the brain of the computer.
It consists of two functional units.
Control Unit (CU)
Arithmetic and Logic Unit (ALU)

Arithmetic/Logic Unit performs arithmetic and


logical operations

Control Unit controls the order in which the


program instructions are executed.

Its functions are

Fetches data and instructions from main memory

Interprets these instructions

Controls the transfer of data and instructions to


and from main memory

Controls input and output devices.

Overall supervision of computer system


Dept. of CSE

16
16

Primary storage

Primary storage is a place where the programs and data


are stored temporarily during processing.
The data in primary storage are erased when the
computer is turned off.

Dept. of CSE

17

Output Devices

Output devices make the information resulting from the


processing available for use. The two output devices more
commonly used are the printer and the computer screen.
The printer produces a hard copy of your output, and the
computer screen produces a soft copy of your output.
Some of the other output devices are
Plotter
plasma display panels
LCD displays
voice output

Secondary storage/ auxiliary storage


Auxiliary or secondary storage is used for both
input and output.
It is the place where the programs and data are
stored permanently.
When the computer is turned off the programs
and data remain in the secondary storage ready
for the next time when it is needed.
The most common types of auxiliary storage
used on personal computers are floppy disks,
hard disks and CD-ROM drives and flash drives.
Dept. of CSE

19

Floppy Disks

A floppy disk is a portable, inexpensive


storage medium that consists of a thin,
circular, flexible plastic disk with a magnetic
coating enclosed in a square-shaped plastic
shell.

Hard Disks
Another form of auxiliary storage is a hard disk.
A hard disk consists of one or more rigid metal
plates coated with a metal oxide material that
allows data to be magnetically recorded on the
surface of the platters.
The hard disk platters spin at a high rate of
speed, typically 5400 to 7200 revolutions per
minute (RPM).
Storage capacities of hard disks for personal
computers range from 10 GB to 120 GB (one
billion bytes are called a gigabyte).
Dept. of CSE

21

Compact Discs
A compact disk (CD), also called an optical disc, is a
flat round, portable storage medium that is usually
4.75 inch in diameter.
A CD-ROM (read only memory), is a compact disc
that used the same laser technology as audio CDs
for recording music. In addition it can contain other
types of data such as text, graphics, and video.
The capacity of a CD-ROM is 750 MB of data.

Dept. of CSE

22

Flash Drives
Flash drive consists of flash
memory storage device
USB flash drives are
typically removable and
rewritable, much smaller than
a floppy disk
Storage capacities can be as
large as 256 GB

Dept. of CSE

23

Hardware : The physical elements of a


computing system (printer, circuit boards, wires,
keyboard)

Software: The programs that provide the


instructions for a computer to execute

Dept. of CSE

24

Computer Software
Software

System Software

Application Software
Dept. of CSE

25

System Software
System software consists of programs that

manages the computer resources.


Divided into three classes
Operating System-user interface, database
access
System support software-other operational
services like disk format programs
System Development software - language
translators and debugging tools

Operating System basics


Operating System is an integrated collection of
programs which make the computer operational
and help in executing user programs.
It acts as interface between the man and machine
It manages the system resources like memory,
processors, input-output devices and files.
Single user operating system, multi user operating
system, real time operating system etc.
Examples are : DOS , UNIX , Windows
Dept. of CSE

27

Application Software
Application
Software
is
directly
responsible for helping users solve their
problems.
Word processing
Electronic spreadsheet
Database
Presentation graphics

Word Processing

Word Processing software is used to create and print


documents. A key advantage of word processing
software is that users easily can make changes in
documents.
Dept. of CSE

29

Electronic Spreadsheets

Electronic spreadsheet software allows the user to


add, subtract, and perform user-defined calculations
on rows and columns of numbers. These numbers
can be changed and the spreadsheet quickly
recalculates the new results.
Dept. of CSE

30

Database Software

Allows the user to enter, retrieve, and update data in


an organized and efficient manner, with flexible
inquiry and reporting capabilities.
Dept. of CSE

31

Presentation Graphics

Presentation graphic software allows the user to


create documents called slides to be used in making
the presentations. Using special projection devices,
the slides display as they appear on the computer
screen.
Dept. of CSE

32

Computer Languages
Machine Language - Only programming language
available in earlier days
Consists of only 0s and 1s
Symbolic language or Assembly language symbols or mnemonics used to represent instructions
hardware specific
High-level languages- English like language using which
the programmer can write programs to solve a problem.
more concerned with the problem specification and
not oriented towards the details of computer.
eg: C, C++, C#, Fortran, BASIC, Pascal etc.

Dept. of CSE

33

Differences between High level Language


and Machine Language

Machine language
Uses two symbols 0 and
1
Each instruction is a
sequence of 0s and 1s
Can be directly executed
Difficult to understand,
write, modify and debug
Efficient(fast)
Not standardized
Called first generation
programming language

High level language


Uses alphabets, digits,
punctuations, special
symbol
Each instruction is a English
like statement
Cannot be directly executed
Easy to understand, write,
modify and debug
Less efficient(slow)
Standardized
Called third generation
programming Language

Dept. of CSE

34

Language translators
Assembler- takes assembly language program
as input and translates it into machine
language
Compiler- takes entire high level language
program as input and translates it into machine
language
Interpreter-takes one statement of high level
language program as input and translates it
into machine language and executes it
Dept. of CSE

35

Differences between Compiler and


Interpreter
All errors that occur in
the program are listed
and displayed
Debugging is faster
Requires more
memory
Costlier

Errors that occur only


in the statement being
taken for translation
are displayed
Debugging is slower
Requires less
memory
Cheaper

Dept. of CSE

36

Computer Memories
The computer memory is classified into
Main memory-Primary storage
Secondary memory-Auxiliary storage
Cache Memory

Dept. of CSE

37

Main memory
This is a temporary memory because the
data and instructions stored here erased
when the power goes off.
This is also referred as primary memory.
It is a semiconductor memory and
measured in terms of megabytes and
gigabytes.
It consists of RAM and ROM
Dept. of CSE

38

RAM stands for Random Access Memory


It is the read and write memory.
The information stored in this memory can be accessed
directly without scanning it sequentially.
Hence it is called as random access memory.
During power failure the information stored in it will be
erased
It is also called as volatile memory.
ROM stands for Read Only Memory
Permanent memory and non volatile.
The contents in locations in ROM can not be changed
It stores mainly monitor programs and basic input output
system (BIOS) programs.
Dept. of CSE

39

PROM :Programmable Read Only Memory


It is a variation of ROM.
The contents of this memory are programmed by the user
These contents can not be erased once they are written to
it.
EPROM : Erasable Programmable Read Only Memory .
It is a modification to PROM.
Contents stored can be erased by exposing it to Ultra
Violet Light source.
EEPROM: Electrically Erasable Programmable Read Only
Memory
The contents stored in this can be erased electrically.

Dept. of CSE

40

Secondary Storage Devices


Because most of main memory is volatile and limited, it
is essential that there should be other types of storage
devices where programs and data can be stored when
they are no longer being processed
Secondary storage devices can be installed within the
computer box or added later as needed

Dept. of CSE

41

Cache memory
It is a High speed memory and placed
between the CPU and the main memory.
Users cannot access this memory.
It stores the data and instructions currently
to be executed.
More costlier than main memory.
Lesser capacity than main memory
Dept. of CSE

42

Vous aimerez peut-être aussi