Computer Basics Elements
Computer Basics Elements
I RD S
COMPUTER BASICS
Introduction :-
Computers are now affecting every sphere of human activity and being about many
changes in Industry, Government, Education, Medicine, Law, and Social Science even in arts
like music and painting.
In fact any task can be done by using computer so it is essential to know about computer.
What is Computer?
Characteristic of Computer :-
1) Accuracy :-
Computer work with very high accuracy. It gives very accurate results
provided that information given to computer should be very correct. This principle of
working of compute is called as GIGO (Garbage in Garbage Out.).
2) Speed :-
Computer works with very high speed. Speed of computer depends on speeds
on speed of microprocessor fixed in CPU (Central –Processing Unit.). The basic unit
used to measure speed of computer is Hz (Hertz).
3) Versatility :-
Computer is a versatile device. It can be adopted or used in any field like
education , banking , railway reservation , entertainment. Its principle of working is
same in any field.i.e.
4) Deligency:-
Computer is a tired less device which works without any problem 24 hrs.in a
day.
5) Automation:-
6) Storage:-
General purpose electronic computers using valves were developed in 1940. In 1823
Charles Babbage an English mathematician designed for automatic computing machine for
automatic computing of mathematical tables. That machine is called as Differential Engine.
First Computer developed is known as ENIAC ( Electronic Numeric Integrator and
Calculator).
Generation of Computer :-
The rapid growth and availability of improved electronic component have resulted in
making computer smaller and enhanced their reliability and reduced their cost . High speed,
large memory are special features in evolution of computer.
1) 1st Generation :-
The 1st electronic computer was completed in 1946 by a team lead by
Prof.Eckert and Prof.Mauchly at university of Pennsylvania in U.S.A. This computer is
called as ENIC ( Electronic Numeric Integrator and Calculator.) It uses high speed
vacuum tubes. It has small memory. It took about 200 microsecond to add two digits and
2800 microsecond to multiply. A idea to store machine instruction in memory of computer
along with data was introduced by John Von Neumann in 1946.
During 1st generation computer programming was mainly done in machine language.
become feasible. High level languages become improved e.g. Fortran IV, COBOL 68,
PL/1.
th
3) 4 Generation :-
Medium scale integration circuits developed to large scale integration and
very large scale integration. Magnetic core memories are replaced by semiconductor
memories. Floppy disk provide a low cost, high capacity backup. Network of computer
and distributed computer system have been developed. A significant development in
software is development of concurrent programming language. There is development of
time shared interactive system. The effective cost of computing has become down. e.g.
Intel 8080, Intel 8088, Intel 80286, Pentium I, II, III.
th
4) 5 Generation :-
It is estimated from 1990. It is now possible to go specialized VLSI chips at
low cost. Thus an architecture in technology and allows an easier and more natural
algorithm. Functional languages are developed . In this generation there is development
of artificial intelligence. Cost of computer become very less . Speed , Storage , Capacity
become very high.
Types of Computer :-
Computer are classified on the base of CPU speed work length directly
addressable memory capacity. Computer are classified in following four types.
1) Micro Computer :-
Consist of microprocessor chip as CPU. It uses RAM, ROM for storing
program, data, floppy disk, and hard disk for permanent storage. Early microprocessor
has word length of 8 bit . But now it is 16,32,64 bits. Only one person can use it. It has
limited capacity of input and output. They have wide range of application. They are used
as parts of instrument, controller of plant and robots and as general purpose computer.
They are used as personal computer and as home computer e.g. Desktop, Notebook,
Personal Digital Assistant.
2) Mini Computers :-
Minicomputers are faster than microcomputer. The speed of CPU is more
than 1 million instruction per second. They are emerged in 1960. They are also called as
midrange computer. e.g. IBM system / 36 IBM system / 38 IBM AS400. They are
generally used at medium scale industries.
3) Mainframe Computers :-
They are also called as Host Computers. They have more processing
speed than micro and mini computers. They are also called as Midi computers. They are
also called as Midi computers. The minimum processing speed is 10 million instruction
per second. They support large compilation intensive scientific and engineering problem
and large scale commercial problem. They are capable of greed data storage. They are
used in company like LIC, Banks etc. e.g. IBM 4300, IBM 4340, NEC ACOS mainframe.
It is designed to support hundred and thousand of user. They have wide range of software
and peripherals.
4) Super Computers :-
It is most powerful type of computer. They are used by very large scale
industries such as NASA.e.g. It performs numeric calculator for weather prediction,
compiled molecular structural calculation. They need additional mainframe computer to
prepare jobs and present them in right order. The above are types of computer according
to processing speed and capacity of computer .
1) Analog Computer :-
These computers are used for measuring purpose. e.g. Voltmeter used to
measure voltage. Thermometer used to measure temperature. They do not perform any
calculation but gives number result.
2) Digital Computer :-
Theses are used for counting or accounting purpose. It always convey all input
in machine language or i.e. in 0 and 1. There fore these computers are called as Digital
Computer.e.g. Microcomputers, Personal Computers etc.
3) Hybrid Computer :-
Hybrid computer are the computer which perform bot task i.e. measuring and
counting or computing. They are mixture of analog and digital computers.
Organization of Computer :-
Typical computer is basically made up of four main units
1) Input Unit
2) Output Unit.
3) Process Unit.
4) Storage.
MEMORY
CONTROL
UNIT
INPUT OUTPUT
ALU
1) Input Unit :-
To accept information /data from user Input unit . The device used to accept
data from used are called as input device. The main function of input device is to
represent user understandable data in machine understandable format. e.g. Keyboard,
mouse, scanner.
2) Output Unit : -
This unit is used to produce information or result. The main function of output device is
to represent result in machine understandable form into user understandable form. e.g.
Monitor
.3) CPU :-
CPU stands for Central Processing Unit. It is heart of Computer. Each and Every
process is performed in CPU.
Application of Computer :-
1) To store large data.
2) For entertainment purpose.
3) For communication purpose.
4) To generate graphics and images e.g. cartoons.
5) In any field like Banking , LIC, Railway reservation or in any business.
Limitation of Computer :-
1) Can not think their own.
2) Do not learn from experience.
3) It has not ability to understand.
4) It can not handle combinatorial explosion.
1) Computer Hardware :-
It includes all physical parts of computer which can be seen or touch. e.g. Keyboard,
Mouse, CPU.
2) Computer Software :-
Computer programs that instruct computer how to process data and generate
required information is called as computer software.
3) Computer Personnel :-
They are also called as user . They are the people who prepare data for computerized
input and write computer programs or handles computer programs.
COMPUTER PERIPHERALS
Computer peripheral means input output devices that form essential link
between user and computer system.
Input Devices :-
Input devices are used to get raw data into the computer.
1) Keyboard :-
This input resembles typewriters. It is used to enter text data into the
computer. There are three type of keys on general keyboard.
a) Alphanumeric keys.
b) Special Keys.
c) Functional Keys.
The alphanumeric keys comprises of alpha bates i.e. (A-Z or a-z) and (0-9)
and also contain some special keys i.e. <,>,?,*,#,:,”,| etc.
The special keys perform specific task e.g. Enter Key, Backspace Key, Delete
key, Caps lock etc.
The shift key alter the meaning of character key which is depressed at
same time. The Ctrl and Alt key generate some function with some other key. The Esc
key is used to escape the function . The function keys are used to perform a set of
operations by a key stroke .i.e. F1 is used to display window help.
2 Mouse :-
One of the most popular type or specialized input device is mouse. It is used as
pointing device. It enables the user to manipulate a pointer or arrow on a terminal or
microprocessor. It help in pointing icon or tiny picture. It can place cursor or point an
item.
It draw line picture on screen. Since the cursor follows the way the
user hand movers the mouse, the cursor has a sense of pointing something on screen. The
mouse can be of three type.
1) Mechanical Mouse :-
It has rotating ball on the bottom and is attached with a Corel to the system. As
we move the mouse the roller rotates and control the pointer on screen
.
2) Optical Mouse :-
It has no moving parts. It emits and senses light to detect mouse movement. It
can be used on any surface. It does not require periodic cleaning.
4) Joystick :-
It is a most popular device for computer games. They are designed in shape of
handles.
5) Barcode Reader :-
They are generally used in superstore. Data is coded in form of light
and dark bars. With coded spacing and thickness. These are called as barcodes which are
commonly used to identify Items
.
a) MICR :-
Magnetic Ink Character Recognition. They read character printed with magnetic ink
i.e. it reads unusual nos. on bottom of the check.
b) OMR :-
Optical Mark Recognition. It detect presence or absence of mark on a paper.
It uses light rays to detect character.
c) OCR :-
Optical Character Recognition. It detect special preprinted character
.
6) Scanning Device :-
It reads data from source like text document , images pictures, graphs. After
image is scanned it comes in memory of the computer then it gets stored permently or
printed on paper. The Scanner can be flatbed or Optical Scanner.
Now a days there are so many input devices are sued like image capturing devices like
camera or web cam. One important input device is microphone which is used to record
sound..
Output Devices :-
Output devices are the devices which are used to obtain output from computer.
Printer and monitor are two output devices which are used to obtain output from
computer
.
1) Monitor :-
It is also called VDU ( Visual Display Unit ) It is a device used for
interactive processing i.e. data i.e. being keyed in is displayed on screed and monitor message
and processed information is also displayed on screen. The combination of keyboard and
VDU which is an input ,output (I/O). Monitor can be of two type.
a) CRT Monitor :-
They uses Cathode Ray Tube that looks like a television picture tube.
The advantages of these monitor are low cost and excellent resolution. The
disadvantages are that they are large in size.
Standard Pixel
2) Printers :-
Printers are used to produce hard copy of the output. Printers are classified by
how they point.
b) Thermal Printer: -
These printer uses heat element to produce image on heat sensitive paper.
They are used in scientific lab and costly.
b) Laser Printer: -
Laser Printer can print one page at a time . It uses a laser beam for printing.
The printing quality of this printer is very high. They are more expensive than all other
printers. There are so many printers are available in market.
MEMORY
MEMORY
PRIMARYY
SECONDARY
RAM ROM
HARD DISK
FLOPPY DISK
COMPACT DISK (CD)
PROM
EPROM
EEPROM
Primary Memory:-
a) RAM:-
b) ROM:-
ROM stands for Read only memory. It stores of data instruction permanently in it
which is used Booting Process. If we switch off our computer then data in this memory
remain unchanged. It is developed by manufacturer. We can read data from this memory . We
can not write any data in this memory. We can not delete data from this memory. Following
are type of ROM.
The PROM has one defect that we can not change the content PROM if there is any
mistake in programming .Then the solution EPROM Where we can erase the content in it. To
erase the content EPROM ultraviolet rays are used.
In this memory we can change the content of memory using electronic field.
Secondary Memory: -
When we want to store data permanently on computers memory then
secondary memory is used . It uses some device or disk to store data. It we switch off our PC
then also content in this memory remain unchanged. Following are the disks which are used
for secondary storage.
a) Floppy Disk :- This is portable disk which is used to store data. It is made up of thin
magnetic material enclosed in protection bracket. It is accessed as drive a or b In market there
are two types of floppy disk available i.e.
a) FLOPPY DISK:-
From Read Write Notch we can read content of Floppy. There is Write Protect Notch present
on floppy which protects writing on floppy but we can read data from floppy. Internal
magnetic disk is deiced into logical circles called as track and these tracks are divided into
sectors.
b) Hard Disk: -
Hard Disk can store large amount of data compare to floppy. It is fixed in
CPU. It can store 20GB, 40GB, and 80GB etc. data in it.
It is faster than floppy. It is made up of aluminum material. Hard Disk consist of one
or more metallic platters sealed inside a container. It contains motor for rotating disk.
It also contains an access arm and read write heads for writing data to and reading
data from the disks.
c) Compact Disk: -
CD uses laser technology. They can store large amount of data compared to
Hard disk and Floppy disk. They are silver coated so that light gets reflected from the
surface of the disk. In market different CDs with Different storage capacity are available.
There are three types of CD.
I) CD-ROM :-
Stands for Compact Disk Read Only Memory. We can read data
from this disk but can not write.
II) CD-R:-
On this CD we can write data only once. But we cannot modify or rewrite another
data on this disk.
III) CD-RW: -
NUMBER SYSTEM
In daily work we use Decimal No. system. This uses 0,1,2,3,4,5,6,7,8,9. Here
we are using 10 nos. Therefore basic of this system is 10. Computer is an electronic device. It
works on light so knows only two states on/off. So computer can understand only language of
0/1. 0 and 1 are called as binary digits and this number system is called as Binary No. system
which uses only two digit i.e. 0 and 1 . The base of this no. system is 2 (Bi means 2) 0 and 1
are called as binary digits i.e. bits.
2 245 1
2 122 0
2 61 1
2 30 0
2 15 1
2 7 1
2 3 1
2 1 1
8 108 4
8 13 5
8 1 1
(108)10 = (154)8
=4x8+5x8+1x8
=0+40+64
=108
3 3 011
4 4 100
5 5 101
6 6 102
7 7 103
To convert octal no. into Binary above given table and write equivalent binary
no. for each digit.
1 7 5
001 111 101
= (1111101)2
3 4 5 3 1
= (34531)8
(110)10= (?)16
16 110 E (14)
16 6 6
(110)10= (6E) 16
To convert a Binary No. into Hexadecimal no. make group of digits from unit
place of binary no. Add 0 to right side of no, if required. Write down equivalent Hexadecimal
No, as shown below.
(111010101111110001010)2= (?)16
1 D 5 F 8 A
= (1D5F8A) 16
To convert a Hexadecimal no. into binary write down equivalent binary no for
each digit in Hexadecimal no.
D 5 F 8 E C
= (1100101011111100011101100)2
BCD numbers:-
BCD stands for Binary Coded Decimal. Here each decimal digit is represented
by equivalent 4 digits binary no.
e.g. 111101010
+ 100100
111 Carry
1000001110
e.g. 1110101001
- 11010001
11 1 Borrow
1000001000
Hardware :-
All physical parts of computer system which we see and touch are
called as Hardware .e.g. keyboard , mouse , monitor etc.
Software :-
We know that computer works on instruction given by user . A set of
instruction is called as program is called as Software. There are four
types of software.
1) Operating System..
2) Languages
3) Translators
4) Utilities
1) Operating System :-
An operating System is essential part of any
computer. It is a program which coordinates and controls the
operation of computer hardware and software resources such as
processors, memory input output devices. It works as interface
between compute hardware and user. Operating system can be of
following type.
UNIX, Windows NT
I) Machine Language :-
This is machine understandable language. Program can be
written in o’s and 1’s. It is machine dependent languages. i.e.
Program written for one machine can not work on other machines.
3) Translators :-
Translators are the programs used for
conversion of High Level Language into machine level
language. Computer can understand only machine language
therefore translators are used. Translators can be of two type.
Interpreter convert program written in High level language
into machine language one line at a time. Complier convert
program written in High level language into machine
3) Utilities :-
a) Antivirus Programs :-
These programs are used to take backup of the important
data for security purpose.
b) Backup Programs :-
c) Uninstall Programs :-
Booting Process :-
a) Command.com
b) MSDOS.SYS
c) IO.SYS
1) Cold booting
2) Warm booting
DOS :-
Dos stands for Disk Operating System , Dos is also called is
command line
Operating system. i.e. it uses command for interfacing . It is a single
user single tasking operating system. i.e. only one user can work on
these operating system at a time and can do only one task at a time .
When we are working is DOS we are diving all commands on C :\>
called as DOS prompt or Command prompt. To work
with DOS we have to use commands. There are two types of DOS
commands
a) Time :-
This command is used to display and change time of
system. The time is displayed in hh;mm;ss.format
c) Date:-
This command is used to display and change date of
system. The date is given is (mm-dd-yy.) format.
c) Cls :
This command is used to clear the content of screen
v) Ver :-
This command is used to display the version of
operating system loaded on your computer.
e) Vol :-
This command is used to display volume label your
disk .
Syntax :- C:\>Vol
f) Dir :-
This command used to see the list of all the contents on the
drive or
any director
Syntax: - C:\>Dir
Switch Meaning :-
what is a file?
Extension.
e.g. if file name is myself. txt then myself is primary file name
and txt is extension primary name and extension is separated by
dots (.)
a)
A primary file name have maximum of 8 characters.
b)
In primary name spaces are not allowed.
c)
No special character is allowed in primary name
d)
Fit may be alphanumeric i.e. combination of (a-z)
and (0-9)
e) Extension is of maximum 3 character long.
f) It optional part in file name
try 1.txt
hellow.dat
rudrani
g)Copy con: -
e.g. type copy con try 1 .txt on dos prompt and press
enter key
types the contents of file where cursor is appeared.
save the file by processing Ctrl+z
h) Type :-
This command is used to display the contents of
existing file
i) Copy:-
This command is used to copy the contents of source
file to
destination file . Syntax : Coy <source file> <destination file>
enter
e.g. .copy try1 ctry 1 tct this copies the contents of try 1
txt to ctry1.txt
j) Rename :-
This command is used to change the name of
existing file
k) Delete:-
This command remove the existing given file from
disk
1) MD (Make Directory ) :-
This command is used to create directory or sub
directory
Wild chard character are the character which are used replace
on two multiple character in dos command three to wild chard
characters used in dos . they are ? and *? is used substitute single
character and * used to substitute multiple characters .
e.g.
a) c:\>dir A*.* :-
b) C:\>copy*.*d: \mydir :-
This command will copy all files on c:to \ mydir.
c)c:\.dir c??.* :-
This command will display list of files whose name
is starting with character c and there are only two character after c
and having any extension.
1) File menu :-
2) Edit menu :-
4) Search menu :-
4 )View menu :-
5) Tools Menu :-
1. Color : -
6. Help Menu : -
a) More :-
e.g. C:\>dir|
b) Tree:-
This commands-displays directories and
subdirectories a tree structure as shown below
Syntax : c:\> tree
C)Deltree :-
d)Chkdsk :-
This command check for the disk and displays disk
status. It display file system , check for all files and folders free
memory space on disk, storage capacity of disk, if there is problem
in any file then / F option used with chkdsk which fixes the errors on
disk. It also find out memory occupied by hidden files, directories
e) Format :-
WINDOWS(GRAPHICAL USER
INTERFACE)
We have seen DOS operating system which provides
command Line interface. We have to remember all command to do
any job in DOS. Windows provide a very easy interface which
shows you all files and command on screen you have to select one of
them . Windows also support multitasking. That means we can here
songs while working on computer. We can open to or more files at a
time. Windows 98, Windows 2003, Windows NT etc are the
operating system developed by Microsoft and supports GUI.
Terminologies in Windows
2) Icons :-
Icon is graphical or pictorial representation of any
file.
3) Shortcuts :-
4) Start Menu:-
This menu contains all software available in your
computer. We can start any application from this menu .
a) Title bar :-
This shows the name of window or software.
b) Menu bar :-
This shows all menu or commands available in that
software.
c) Minimize Button :-
d) Close Button :-
This button close the active window
.
e) Maximize Button :-
Start Menu :-
2) Run :-
This allows to run any file or program. e.g. When we
run command. com DOS will get start.
4) Search :-
Search allows searching of particular files or group of
files on different drives on disk.
5) Settings :-
Allows to change system setting for different
peripheral devices like printer, internet, network, fonts etc.
6) Documents :-
7) Program :-
1) Wallpaper :-
2) Screensaver :-
A moving pattern appeared on screen when here is no
movement of mouse or keyboard is called as screen
Explorer :-
To open windows explore Press right button of mouse
on start button. A Shortcut menu will appeared Click on explore
option. A start menu window will get appeared which explores each
folder and subfolder on given path.
Creating a shortcut :-
To create short cut Click on file menu in
explorer. Then click on NEW-> Shortcut. " Create Shortcut" Dialog
will get appeared on screen. This will ask ask for the file or program
to which you want to create shortcut. Give that filename with path or
select that file suing . Brows button. Then click on next button and
give name to the shortcut and click on finish button.
To create Shortcut on desktop press right
mouse button. A shortcut menu appeared . Click on New-> Shortcut.
"Create Shortcut" . Dialog will get appeared on screen and then
select file or give path of file and then click on next button give
name to shortcut and click on finish button.
My Computer :-
Recycle Bin :-
Calculator :-
Notepad :-
File Menu :-
Edit menu:-
c) Give the word which we want to fine . Match case matches the
upper and small letters.
d) Click on Find next to find the word.
c) Give the word which we want to find . Also specify the word with
which you want replace current word. Match whole word matches
the words and match case matches for the upper and small letters.
d) Click on replace to find and replace one word at a time and click
on replace all to find and replace one word at a time and click on
replace all to find and replace all words at a time.
Format Menu :-
1) Word wrap :-
2) Font :-
We can change font , font size , and font style.
Help Menu :-
PAINT BRUSH
4) Click on 'paint'.
2) Selection tool :-
This tools is used to select rectangle area in
file.
3) Eraser tool :-
5) Pick up a colour :-
7) Rectangle tool :-
This tool is used to draw a rectangle drag & method.
To draw exact square this tool is used with shift key & drag rectangle
tool to get exact square.
9) Circle / Ellips :-
This tool is used to draw ellips. To draw exact ellips
press shift key and then drag and draw circle. In all rectangle and
ellips tool we can change the format of tools from the format given
below tool box.
14) Text :-
This tool is used to type text in picture
16) Pencil :-
This tool is used for free hand drawing.
File Menu :-
Print Preview :-
Edit Menu :-
1) Undo :-
2) Repeat :-
Select All :-
Copy to:-
To copy selected drawing or whole drawing to
another new file this option is used.
Paste From :-
To bring a drawing from another file to current file this
option is used.
c) Click on open.
View Menu :-
This menu is related with display of tool box, color
box, status bar, text tool bar on screen. We can active or inactive
them from view menu by clicking on corresponding option.e.g. if
color box is inactive to active it click on View-> Color box. A check
mark indicates that it is active. To inactive it do same View-> color
box. Text tool bar is active if Text tool is selected from tool box. It is
used to change font , font size text. Ctrl+T is shortcut key to activate
tool box and Ctrl+L active color box.
1) Zoom in : -
2) Show grid :-
Image menu :-
Flip Rotate :-
gives Vertical image. Click on ok to apply Ctrl+R is short cut key for
flip and rotate effects.
Attributes :-
Draw opaque: -
Color Menu :-
We can edit different colors in color box used Color->
Edit colors option .
WORD PAD
Word Pad contains tool bars and Menu bar and ruler and
status bar as shown above. In word pad by default file name is
documet.doc. We can also create rich text document and Unicode
documents in WordPad.
File menu :-
a) Click on file->Open
b) Selected file name from appropriate path and Click on
open button. To save modification in already saved file use
save option in file menu.
Print Preview :-
Print preview means view of document before
printing it.
Edit Menu :-
1) Undo :-
2) Repeat :-
This repeat the action which is recently canceled.
Paste Special :-
This option is used to paste cut or copied text in
special format.i.e. in unformatted text or in picture format.
Select All :-
Selects Whole text. Ctrl+A is shortcut key for
Select All.
a) Click on Edit-> find option Find dialog box same as in Note pad
will get appear.
b) Give the word which we want to find. Match case matches for the
upper and small letters.
c) Click on Find next to find the word . F3 is shortcut key for find
next.
View Menu:-
Tool Bar :-
Formatting bar :-
Using this bar we can one age formatting of text using
font, font size, bold, italic etc tools.
Status bar gives of Num lock, Caps lock etc and status of file.
and wrap to ruler means new line start at end of ruler i.e.
right indent of paragraph.
Insert Menu :-
2) Object :-
Using this option we can insert new object file from
different software like Corel draw or paint brush etc.
Format Menu :-
Font :-
To change font, font style , font size and color of
selected text font is used.
b) Set font font , font style , font size and color in font dialog box.
Bullet Style :-
This will apply bullets to each paragraph in
selected text.
Paragraph :-
This is used to left , right , first line margin and
alignment of selected paragraph.
b) set left , right line margin and set alignment and click on ok apply
settings.
INTRODUCTION TO WORD
INTRODUCTION :-
Starting MS-Word :-
Title Bar :-
Menu Bar :-
Standard Toolbar :-
1) Style :-
2) Font :-
3) Font size :-
5) Alignments :-
6) Indents :-
7) Border :-
8) Highlight :-
9) Font color :-
Status Bar :-
b) Select the path where you want to store the document and then
give file name and click on button 'Save'. The name given by you
will appear on Title bar.
3) Version :-
b) Select file name which you want to open from appropriate path
and click on Open.
5) Page Setup :-
There are four tabs in Page setup Margins, Paper Size , Paper
Source and Layout.
In Paper size tab we can set paper size, we can also set paper
size according to our requirement. Orientation may be portrait or
landscape . In Layout tab we can set header footer and we can set
border and line numbers.
6) Print Preview :-
7) Send To :-
8) Properties :-
1) Undo (Ctrl+Z) :-
2) Redo (Ctrl+Y) :-
3) Moving text :-
4) Copying Text :-
5) Paste Special :-
6) Clear (Del) :-
8) Finding Text :-
1) Match Case :-
4) Sounds Like :-
a) Click Edit-> Replace. The same dialog like fine will appear. All
search options and format are same as they are in find dialog. Only
the difference is that here we can replace the text found, with another
word.
b) Type text that you want to find in 'Find What' box and type the
word by which you want to replace in 'Replace with' Text box..
10) Go to:-
in 'Enter page number' box and click on 'Next' button the cursor will
move to the specified page no. If+5 is given then cursor will move in
forward direction and if sign is given then cursor will move in
backward direction.
a) Normal View:-
b) Web Layout :-
c) Print Layout :-
d) Outline View:-
2) Tool Bars :-
1) Standard
2) Formatting
3) Auto text
4) Control tool box
5) Data base
6) Drawing
7) Forms
8) Outline
9) Picture
10) Reviewing
11) Table and Borders
12) Visual Basic
13) Web
14) Word Art
15) Custom & Customize etc.
A check mark will appear in front of name of tool bar which are
active. In MS - Word by default Standard, Formatting and Drawing
toolbars are active.
3) Ruler :-
4) Document Map :-
7) Full Screen :-
8) Zoom :-
1) Break :-
Text wrapping break end the current line where the cursor is
placed and move cursor to next line.
2) Page Numbers :-
4) Symbols :-
5) Fields :-
categories of fields like date and time formulas. We can select fields
in specific category and click on Ok button to insert that field. i.e.
select category 'Date and Time' and field 'Date' as shown in
following window and click on Ok it will insert current date in
document.
6) Auto text:-
This option is used to insert Auto text. Auto text is
text which you are using frequently in document. e.g. yours
faithfully, respected sir etc.Auto Text offers a way to store and
a) Select table, text or object for which you want to create Auto text.
b) Click Insert->Auto text->New.
c) Give simple name for Auto text.
This will create auto text with given name which appears in
Normal auto text. When you want to insert this auto text in
document. Then Click on Insert->Auto text->Normal->Auto text
name. Then the corresponding table or text gets automatically
inserted in document.
7) Comment :-
8) Footnote :-
9) Caption :-
10) Picture:-
a) Clip Art :-
b) From File :-
c) Auto shapes:-
d) Word Art:-
11) File :-
12) Object:-
13) Bookmark :-
14) Hyperlink :-
1) Font:-
2) Paragraph:-
5) Columns:-
6) Change Case :-
1) Sentence Case :-
2) Lower Case :-
3) Upper Case :-
4) Title Case:-
5) Toggle Case:-
7) Tabs :-
8) Drop Cap :-
a) Click Format-> Drop cap. Following dialog will appear. There are
two types of drop cap position i.e. Dropped or In margin. Select on
of them. Then set font, no. of lines to drop and distance from text
and click on Ok button to apply settings.
9) Background:-
b) We can also fill more patterns using fill pattern option. From
following dialog box select the pattern and color of pattern you want
to fill. There are four tabs. Pattern tab is used to fill pattern. gradient
tab is used to fill different color with different shading style. Texture
tab is used to fill different available texture to page. Texture are
some predefined patterns that we can apply to background of
document. Picture tab is used to apply picture from different
software like paint brush etc.to background of the page.
10) Theme:-
12) Style:-
2) Word Count:-
3) Auto Summary:-
4) Auto Correct:-
5) Language:-
1) Language:-
2) Thesaurus:-
3) Hyphenation:-
6) Track Changes:-
7) Protect Document:-
8) Unprotect Document:-
9) Mail-Merge:-
Insert Merge field contains all fields in data source. Insert the
data fields at appropriate place. View merged data tool shows current
merged record. We can change record using Next, Previous, First or
Last tool. to merge all records or selected records click on Mail
merge helper tool. This will again display mail merge helper
window. Click on Merge button and give range of records which you
want to merge and click on Merge button. You will found a separate
letter corresponding to each record.
12) Macro:-
Macro is a collection of instruction. To create a new macro
click Tools->macro->Record new macro. Now the recording gets
started. Execute all the instruction which you want to copy in macro.
Then stop the recording of macro and save macro.
1) Draw Table:-
We can select the line style, width, color and draw the table.
2) Insert:-
This is used to insert tables, rows, columns etc. There are five
sub menus.
a) Table: -
This option is used to insert table with required no, of
columns and rows. When we click Table->Insert->Table. Following
dialog will appear. Give No. of columns, no. of rows and behavior of
the table and click on Ok button to insert the table.
d) Similarly we can insert rows to above and blow of the row where
the cursor is placed.
e) Cells:-
3) Delete:-
This option is used to delete specified no. or selected rows or
columns or cell. We can also delete the whole tables.
When we delete the cell it will ask for where to shift cell
either on up or left as shown below. Specify where to shift cells and
click on Ok button to delete the cell.
4) Select:-
This is used to select table, row, columns or cells.
5) Split Cell:-
6) Merge Cells:-
7) Spilt Cell:-
8) Auto Format:-
9) Auto fit:-
10) Convert: -
We can convert text to table and table and table to
text.
11) Sort:-
12) Formula:-
INTRODUCTION TO MS-
EXCEL
Ms-Excel is spread sheet software. This is used to create
sheets where numeric calculations are required e.g. salary sheet,
mark sheet etc. It is a part of MS-Office.
Starting MS-Excel:-
1) Sheets:-
There are three sheets in a book. We can insert 256 sheets in
a file. A sheet contains rows and columns. There are 65536 rows and
256 columns on on sheet. A, B, C ... IV are the name given to
column. 1, 2, 3, ... 655536 are name given to row Intersection of one
row and one column is called as cell. Each cell has address shown on
formula bar. A cell address is combination of name of row
Intersection of one row and one column is called as cell. Each cell
has address shown on formula bar. A cell address is combination of
name of row and column. A1 is address of first cell. Group of more
than one cell is called as range. Address of range is given by address
of first cell and address of last cell. A1: C5 is range include cell from
A1 to A5, B1 to B5 and C1 to C5. A cell may contain numeric or
string value of formula.
2) Auto Complete:-
3) Auto Fill:-
3) Close:-
4) Save as Workspace:-
When you open this work space from File->open all the
workbooks in the workspace get open.
5) Setting Page:-
To set paper size, margin header and footer click File->Page
setup. Following dialog will appear. There are font tabs. Page tab is
used to set orientation of page, paper size, zooming percentage and
printing quality. Margin tab is used to set Top, Left, and Right,
Bottom and Header and Footer margin of the page. Header and
Footer tab is used to set header and footer or the page. We will see
this in next chapter.
Sheet tab is used to set print area page order and printing
options.
7) Print Preview:-
8) Printing Sheet:-
Edit Menu:-
1) Undo (Ctrl+Z):-
2) Redo (Ctrl+Y):-
4) Copy Cells:-
5) Filling Contents:-
6) Filling Series:-
a) Linear Series:-
b) Growth Series:-
c) Date Series:-
7) Clear:-
a) All:-
b) Formats:-
c) Contents:-
d) Comments:-
8) Delete:-
To delete cell or range of cell click Edit->Delete. Following
dialog will appear. Shift cells left means shift the contents from right
side cells to left. Shift cells to up means shift the contents of cells to
Up means shift the contents of cells from down to up. Delete entire
row or column. Select one of the option and click on Ok button to
apply.
9) Delete Sheet:-
12) Go to:-
View Menu :-
1) Views in Excel:-
There are two different views available in excel. In
Normal view no different pages are shown on sheet. In Page break
preview different pages are shown on sheet.
4) Comments:-
5) Full screen:-
6) Custom views:-
1) Inserting Cells:-
2) Inserting Rows:-
3) Inserting Columns:-
4) Inserting Sheet:-
5) Inserting Chart:-
b) Click Next button. Following window will appear. give data range
i.e. select table or specific column. Select name column and press
Ctrl button and select Total Column Click on Next button. Following
window will appear. Give Title to chart, information about axe,
Position of legend, table and label. Click on Finish button to
Complete and finish the chart. Following chart will get inserted in
table.
a) Sum ( ):-
b) Average ( ):-
c) Max ( ):-
= Max (A1:A5)
d) Min ( ):-
e) Count ( ):-
f)Counta ( ):-
g) Char ( ):-
h) Len ( ):-
i) Upper ( ):-
j) Lower ( ):-
Logical conditions:-
1) And ( ):-
2) Or ( ):-
3) Not ( ):-
=Not (A1=35)
T T T
T
T F F
T
F T F
T
F F F
1) Formatting Cell:-
2) Formatting Rows:-
3) Formatting Columns:-
4) Formatting Sheet:-
5) Auto Format:-
6) Conditional Formatting:-
Tools Menu:-
2) Goal Seek:-
3) Creating Scenarios:-
4) Auditing in Excel:-
Data Menu:-
1) Sort:-
2) Filter:-
3) Form:-
4) Subtotal:-
Name to find subtotal. Select the field that you want to sum
and click on Ok button to find subtotal. You will get total of sale
according to company name.
5) Validation:-
6) Text to Column:-
Suppose Field name are given in cell and you want to make it
separate as shown below. Click Data->Text to column. Following
dialog will appear. Click on
7) Consolidate:-
First reference and add it. Then select second reference and
add it and click on ok button to find sum of corresponding cell
values in references at destination.
8) Pivot table:-
Freeze Pane:-
INTRODUCTION TO MS-
POWERPOINT
2) Design Template:-
4) Blank Presentation:-
Saving Presentation:-
a) Save as:-
b) Save:-
Select the printer, Print range, No. of copies, What you want to print
i.e. handouts or notes pages, No. of slide on one handout, Gray scale,
Pure black and white etc. and click on Ok to print.
Editing Presentation:-
b) To copy the object or slide select the object or slide Click Edit-
>Copy and place the cursor where you want to paste or copy the
slide or object and click Edit->Paste.
To delete the slide select the slide and then click Edit->Delete or
press Del key from keyboard.
4) Duplicate Slide:-
Viewing Presentation:-
1) Views in PowerPoint:-
a) Normal:-
d) Slide Show:-
a) Slide Master:-
b) Handout Master :-
2) Slide Miniature:-
5) Comment:-
6) Zoom:-
Insert Menu:-
3) Comment:-
6) Insert Table:-
1) Font:-
a) Select the text; click Format->Font Font dialog will appear. Make
the settings and click on Ok to apply the settings.
3) Alignment:-
4) Line Spacing:-
5) Change Case:-
6) Replace Font:-
7) Slide Layout:-
9) Background:-
Select the template from design available and click on 'Apply' button
to apply the settings.
1) Hide Slide:-
2) View Show:-
3) Rehearsal Timings:-
4) Set up Shows:-
5) Custom Shows:-
Following dialog will appear. Give to show and add the slide
from original presentation that you want in show. Click 'Ok' button
to apply the settings.
7) Action Button:-
INTRODUCTION
Language:-
The language is the way of communication between two
persons.
C-Language:-
Advantage:-
e.g.:- C Language.
History of 'C':-
Introduction to 'C':-
Importance of C:-
Types of Constants:-
Constants
Primary Constant
Secondary Constant
Array, Pointer
Structure, Uninon,
Integer Real Character enum,
etc.
Constant constant constant
Real constants are often called Floating point constants. The real
constants could be written in two forms. Fractional form and
Exponential form.
They are also called as macro. Here PI and MARKS are macros.
Types of C variables:-
C Keywords:-
C Instructions:-
Arithmetic Instructions:-
Control Instructions:-
Linking.
Constant declaration.
Global variable declaration.
Main ( ) function.
Local variable declaration.
Input statement.
Calculation or processing.
Output statement.
User defined functions.
Linking:-
1) Stdio.h:-
2) Conio .h:-
3) Math.h:-
4) String.h:-
Constant Declaration:-
Main ( ) function:-
Input Statement:-
After local variable declaration, input statement can be given
to input or accept the data from user, for this C provides standard
input function: scanf ( ).
Output Statements:-
Data types:-
These data types varies according to their storage size and the range
of value
they can hold . The range and bit size of each data types is given
below;
PROGRAMMING IN C
Algorithm:-
Algorithm:-
Flowchart:- Start
int a, b,c
c = a+b
End
Program:-
# include<stdio.h>
main ( )
{
int a,b,c;
clrscr ( ); /* To clear the
screen */
printf ("Enter two numbers");
Scanf ("%d%d", & a , & b ); /* accept
2 numbers */
c = a+b; /* performs
addition of a and b */
printf ("\n Addition = %d", c); /*
Displays the result */
}
Compile :- Alt+F9
Execute :- Ctrl+F9
Output :- Alt+F5
With every c program i.e. c file two more files gets created:
Main ( ):-
Printf ( ) :-
OR
Examples:-
"\n":- It is called new line and it takes the cursor to the next line
Scanf ( ) :-
Syntax: -
Example:-
# include<stdio.h>
main ( )
{
int rno, sub1, sub2 , total;
float per;
printf ("\n Enter rollno:");
scanf("%d",& rno);
total = sub1+ sub2
per = total / 2;
printf ( "\n\t\t STUDENTS MARKLIST");
printf ( "\n\t\t -------------------------------");
printf ( "\n\n\n\t Roll No. = %d", rno);
printf ("\n\t -----------------------------");
printf ( "n\t\t English \t\t Math");
printf ("\n\t\t %d \t\t %d", sub1 , sub2);
printf ("\n\t -----------------------------------");
printf ("\n\t Total = %d", total);
printf ("\n\t Percentage = %2f", per);
getch ( );
}
Output is :-
STUDENTS MARKLIST
Roll No. = 1
English Math
70 70
Total = 140
Percentage = 70.00
The program contains formatting character like '\n' , '\t' etc. they are
known as escape sequences. Escape sequences always begins with '\'
followed by a character. Following are the escape sequences :
DECISION MAKING
Operator in C :-
Mathematical Operators :-
Relational Operator :-
Note :-
Logical Operators :-
Hierarchy of Operators :-
Highest ( ), | | , ->
!, ~, ++, --, -, *, &
*, / , 5
< , <=, >, >=
==,!=
&&,||
?:
Lowest = , + = , -= , *= , /=
If statement.
Switch statement.
The If statement :-
Syntax :-
If (condition)
{
execute statements;
}
Simple If
Multiple If
Nested If
Syntax :-
If (condition)
{
group of statement 1;
}
else
{
group of statement 2;
}
# include <stdio.h>
main ( )
{
int basic;
float gross, hra, da;
printf ("Enter the basic salary");
scanf ("%d", & basic);
if (basic <1500)
{
hra = (float) basic*10/100; // Typecasting basic to
float
da = (folat) basic*90/100;
}
else
{
hra = 500
da = basic*98/100;
}
gross = basic + hra + da ;
printf ('\n HRA = %2f\t\t DA = %2f ", hra,da);
printf ("\n\n\t Gross Salary = %2f ", gross );
}
# include <stdio.h>
main ( )
{
int a,b;
clrscr ( );
printf ("\n Enter two numbers :");
scanf ("%d %d ", & a , & b);
if (a>b)
printf ("\n A is greater ");
else
printf ("\n B is greater ");
getch ( );
}
Nested If :-
if (condition 1) /* Outer if */
{
Group of statements 1;
if (condition 2) /* Inner If */
Group of statements 2 ;
else
{
Group of statements 3;
}
}
else
{
Group of statement 4;
}
In this case the second if statement is known as inner if and main
if statement is known as outer if. The if condition will be
checked only when the outer if condition is satisfying.
Example :- To find greater number between three numbers
entered.
# include <stdio.h>
main ( )
{
int a, b,c;
printf ("Enter three numbers");
scanf ("%d %d %d", & a , & b , & c );
if (a>b)
if (a>c)
printf ("\n A is greater ");
else
printf ("\n C is greater ");
else
if (b>c)
printf ("\n B is greater ");
else
printf ("\n C is greater ");
getch ( );
}
Syntax :-
if (condition)
statement 1;
else if (condition 2)
statement 2;
else if (condition 3)
statement 3;
:
:
else if (condition N)
statement N;
else
statement X;
Per Grade
Between 50-59 'C'
Between 60-75 'B'
Above 75 'A'
Below 50 ' Fail'
# include <stdio.h>
main ( )
{
int rno;
float per;
printf ("Enter rno and percentage for a student");
scanf ("%d %f ", &rno, &per);
if (per>=50 && per<60)
printf ("\n Grade = C");
else if (per>= 60 && per<75)
printf ("\n Grade = B");
else if ( per>=75)
printf ("\n Grade = A");
else
printf ("\n student is Fail");
getch ( );
}
Conditional operator :-
Syntax :-
Example :-
# include <stdio.h>
main ( )
{
int x, y ;
printf ("\n Enter number:");
scanf ("%d", &x);
y = (x > 5 ? 3:4);
printf ("%d", y );
}
Example :-
# include <stdio.h>
main ( )
{
char a;
int y ;
printf ("\n Enter any character:");
scanf ("%c", &a);
y = (a>=65 && a<=90 ? 1:0);
printf ("%d",y);
}
ITERATION CONSTRUCT
START
initialise
Test
condition
True STOP
Body of loop
Increment
While Loop
Syntax :-
Operators :-
i = i+1
i++ : It is a increment operation which increments the value of i by
one.
i + = 1 : is a compound assignment operator. It is increment the value
by 1.
The above three statements are same, they will give the same result
i.e. i will be incremented by 1 use any of them.
# include <stdio.h>
main ( )
{
int i=1; / / initialization.
while (i<=10) / / condition
{
printf ( "\n %d ", i);
i++; / /
increment.
}
getch ( );
}
Syntax :-
START
initialise
False
Test
condition
True STOP
Body of loop
Increment
For Loop
Syntax :-
do
{
group of statements;
loop counter variable;
} while (condition)
START
Initialise
Body of Loop
Increment
True
Test
Condition
False
STOP
Do.... While loop
# include <stdio.h>
main ( )
{
int n=1; / / initialization.
do
{
printf ("\n %d", n);
n++;
/ / increment.
} while (n<=10); / /
condition
getch ( );
}
# include <stdio.h>
main ( )
{
int b,c;
for ( i = 1 , j =10 ; i <= j ; i++, j--)
{
printf ("\n %d", i );
}
getch ( );
}
# include <stdio.h>
main ( )
{
int p , n , count;
float r , si;
for (count = 1; count <=3; count =
count+1)
{
printf ("\n Enter values of p, n
& r");
scanf ("%d %d %f ", & p , &
n , & r);
si = p*n*r/100;
printf ("\n Simple interest = Rs.
%2f", si);
}
getch ( );
}
The loop that we have used so far executed the statement within
them a finite number of times. However in real life programming
one may come across a situation that it is not known beforehand how
many times the statement in the loop are to be executed. In such case
we can use infinite loop.
# include <stdio.h>
main ( )
{
char another = 'y'
int num;
while ( another = = 'y' or another = =
'Y')
{
printf ("\n Enter a number");
scanf ("%d", & num);
printf ( "square of %d is %d",
num , num*num ); printf ("Another number
(y/n) ? ");
flush (stdin);
scanf ("%c", & another );
}
In this program the while loop would keep getting executed till the
user continues to answer Y. The moment he answers n , the loop
terminates, since the condition (another = = 'y') fails. flush (stdin) is
used to remove any data remained in the buffer. The argument stdin
means buffer related with standard input device.
# include <stdio.h>
# include <dos.h>
# include <process.h>
main ( )
{
int i = 1;
for ( ; -;)
{
printf ("\n %d", i);
delay (1000);
if (kbhit ( ))
{ exit (0); }
i++;
}
}
The above program will be executed until user hits a key. Number
will be printed one by one with some time duration delay ( ), kbhit
( ), exit (0) are the built in functions.
Kbhit ( ):-
Exit (int) :-
Nested loop :-
# include <stdio.h.
main ( )
{
int i , j ;
for ( i=1 ; j<=1 ; j++)
{
printf ("*");
}
printf ("\n");
}
getch ( );
}
Here inner loop will be executed for 5 times till outer if condition is
satisfying. First a single '*' will be printed and inner loop will be
closed then cursor will be set to next line using "\n". i will be
incremented and again inner loop will be executed, now it will print
two stars. Outer loop value remains constant for complete inner loop.
# include <stdio.h>
main ( )
{
int num , i , prime =1;
printf ("\n Enter a number");
scanf ("%d", & num);
i = 2;
while (i < num)
{
if (num %1 = = 0)
{
prime = 0;
break;
}
else
{
prime =1;
}
i++;
}
if ( prime = =1)
printf ("Number is
Prime ");
else
printf ("\n Number is
not prime");
getch ( );
}
# include <stdio.h>
main ( )
{
int i , j ;
for (i =1; i<=2; i++)
{ for ( j =1; j<=2; j++)
{ if (i = = j)
continue;
printf ("\n %d %d \n ", i , j);
}
}
}
Syntax :-
START
Yes
Case1 Statement 1
No
Yes
Case2 Statement 2
No
Yes
Statement 3
Case3 No
Yes
No Case4 Statement 4
Switch
STOP
# include <stdio.h>
main ( )
{
int i = 2;
switch (i)
{
case 1 : printf ("\n I am in case 1");
break;
case 2 : printf ("\n I am in case 2");
break;
case 3 : printf ("\n I am in case 3");
break;
default : printf (" I am default ");
}
getch ( );
}
# include <stdio.h>
main ( )
{ char c = 'x ' ;
switch (c)
{
case ' v ' : printf ("\n I am in
case v");
break;
case ' a ' : printf ("\n I am case
a ");
break;
default : printf ("\n I am in
case default");
}
getch ( );
}
The output of this program is : ' I am in case default '.
MENU
-----------------------
1. Circle .
2. Square .
3. Exit .
------------------------
# include <stdio.h>
# include <process.h>
# define PI 3.14
main ( )
{
int r , ch ;
float a;
clrscr ( );
printf ("\n\t MENU");
printf ("\n\t ------------------");
printf ( "\n\t 1. Circle.");
printf ("\n\t 2. Square. ");
printf ("\n\t 3. Exit . " );
printf ("\n\t -----------------------")'
printf (\n\t Enter your choice :");
scanf ("%d", & ch);
switch (ch)
{
case 1 : printf ("\n Enter radius :");
scanf ("%d", & r);
a = PI*r*r;
printf ("\n Area or Circle =
%.2f", a);
break;
case 2 : printf ("\n Enter side:");
scanf ("%d", & r);
a = r*r ;
printf ("\n Area or Square =
%.2f", a);
break;
case 3 : exit (0);
default : printf ("\n you have entered
wrong choice!");
}
getch ( );
}
ARRAYS
1) One dimensional.
2) Two or multi dimensional.
int a [5];
char str [10];
int num [3] [3];
char name [5] [10];
In above example a and str are one dimensional arrays while num
and name are two dimensional array, a is integer array with five
elements, num is a two dimensional array having 3*3 - 9 elements. It
is also known as a 3 by 3 matrix with 3 rows and 3 columns.
Character Array have some differences, str is one dimensional
character array which can hold 10 characters i.e. one word. While
name is a two dimensional character array in which first dimension
is the number c elements and second dimension is the width of each
element i.e. name array can hold five names each of having 10
characters length. We can not store multiple strings in a single
dimensional array.
Memory location
Number
Element number
0 1 2 3 4 5
Num
Array Name
Initialization of Array:-
35 40 45 50 55
Initialization of Array
0 1 2 3 4
num
The subscript of an array can be integer constants, integer variables
like p , or expression that yield integers, or all characters etc. usually
the array of characters is called a "string", where as a array of
integers & floats is called simply array.
Note :-
All the elements of any array must be of the same type i.e. we cannot
have an array of 10 numbers of which 5 are integers and 5 are floats.
W E L C O M E \O
Name
Character Array
Each character in the array occupies one byte of memory and the last
character is always '\O' (null character). It tells that where the string
ends. The string without '\O' is not a string but just a collection of
characters. Using this we do not have to rely upon the length of the
string. When the compiler sees a character string it terminates it with
an additional null character. Thus the element name[8] holds the null
character. When declaring character. arrays we must always allow
one extra elements space for the null terminator.
# include <stdio.h>
main ( )
{
int a[5] = {35,40,50,20,60};
int i;
clrscr ( );
for (i = 0 ; i<5; i++)
{
printf("\n %d", a[i]);
}
getch ( );
The program will print five numbers stored in the array. Arrays can
be manipulated using a loop. Elements can be varied using a variable
i i.e. a[i] will refer to each element. To repeat the same procedure a
loop is used. But here every time it will print the same five numbers,
to print the numbers entered through keyboard scan ( ) function
should be used.
# include <stdio.h>
main ( )
{
int a[5];
int i;
clrscr ( );
printf ("\n Enter five numbers:");
for (i = 0; i<5; i++)
{
scanf ("%d", & a [i] );
}
printf ("\n Five numbers entered");
for ( i = 0 ; i<5 ; i++)
{
printf ("\n %d", a[i]);
}
getch ( );
}
Here every time it will accept new numbers and print it. Character
arrays are manipulated in the same way as integer array.
# include <stdio.h>
main ( )
{
char str[25];
clrscr ( );
printf ("\n Enter a string :");
scanf ("%s", str);
printf ("\n the array is : %s", str);
getch ( );
}
Here for loop is not required and we have to specify the array name
only in the printf ( ) and scanf ( ) statement. Another way to access
the array elements is using pointer, which we will see later.
# include <stdio.h>
main ( )
{
char str [25];
int i = 0;
printf ( "\n Enter a string:");
gets (str);
while (str[i] != ' \ O' )
{
if (str[i] >=97 && str[i] <123)
{ str[i] = str[i] - 32 ; }
i++;
}
printf ("\n String in upper case :");
puts (str);
getch ( );
}
Syntax :-
Example :-
10 20 30 40
name [0] P a r a g \0
name [1] R a m \0
A k s h y \0
name [2]
Character Array
# include <stdio.h>
main ( )
{
int n[3][3];
int i , j;
printf ( "\n Enter the numbers for a 3 by 3
array :");
for (i = O ; i<3; i++)
{
for (j = O ; j<3; j++)
{
scanf ("%d", & n [ i ] [ j ]);
}
}
printf ("\n the numbers are : \n");
for (i = O; i<3 ; j++)
{
for ( j = O ; j<3; j++)
{
printf ("%3d", n [i ] [ j ]);
}
printf ("\n);
}
getch ( );
}
It the numbers entered as 1 2 3 4 5 6 7 8 9 then they are printed in
following format
1 2 3
4 5 6
7 8 9
STORAGE CLASSES
Storage :- Memory
Default Initial Value :- A garbage value or unpredictable value.
Scope :- Is accessible to the block only in which it
is defined.
Life :- Remain in existence till the control is
within the block.
Where 2765, 1211 are the garbage values of i and j. These variables
are not accessible by any other function in the program. Its scope
and life is restricted for the procedure in which it is defined.
Values stored in the CPU register can be accessed faster than the
values stored in memory. When any variable is occurring multiple
times in the program, its storage class should be register.e.g. Loop
counter variables can be stored in the register as its values changes
many times in the program. Only the thing to remember is that CPU
registers are limited. .If the variable doesn't get stored into register
because of unavailability of space then the variable will be
considered as auto. We can not use register storage class for all types
of variables.
# include <stdio.h>
main ( )
{
register int i ;
for (i = 1; i<=20; i++)
{
printf ("\n %d", i);
}
}
Here variable i is stored in register so it gets accessed faster in the
loop.
Here variable gets initialized only once. For other function calls, the
value remains as it is. So the output is in incremented form. Static
variables are also local to the block in which it is defined. If the
variable is defined auto every time the value of i will be printed as
1
1
1
Storage :- Memory
Default initial value :- Zero
1 / / initial value of i
2 / / changed by increment ( ) function.
1 / / changed by decrement ( ) function.
0 / / again changed in main ( ) function.
This shows that the variable is accessible by all the functions in the
program and its values also remain as it is. Initial value of i is 1 it
The output is :-
20
10
The i variable is defined two times. The variable defined inside main
( ) is local variable and variable above main ( ) is global which is
accessible by any function in the program. So print ( ) statement in
main ( ) will print the value of i as 20 . Then it is calling show ( )
function which will print the value of i as 10 it access the global i
variable . The states that "in any function the local variable gets
preference over the global variable".
STRUCTURES
Declaring a Structure:-
Example:-
struct book
{
char name [15];
float price;
int pages ;
};
main ( )
{
struct book
{
char name[15];
float price;
int pages;
};
struct book b1, b2, b3;
Example :-
struct book
{
char name[10];
float price;
int pages ;
};
struct book b1 = {"Basic", 130.00, 500};
struct book b2 = {"Physics", 80, 900};
Note that before the dot there must always be a structure variable
and after the doe there must always be a structure element (member).
# include <stdio.h>
struct student
{
int rno;
char name [20];
int m1, m2, tot;
float per;
};
main ( )
{
struct student s1 = { 1, "Ram", 70, 70, 140, 70};
clrscr ( );
printf ("\n \t The student information");
printf ("\n \t ------------------------------------------------");
printf ("\n \t Roll No. Name Sub1 Sub 2 Total Percentage");
printf ("\n \t %d %s %d %d %d %d
%.2f", s1.rno,
s1.name , s1.m1, s1.m2, s1.tot, s1.per ");
getch ( );
}
# include <stdio.h>
main ( )
{
struct book
{ char name [15];
int price, pages;
};
struct book b1, b2, b3;
printf ("\n Enter name, prices & no of
pages for 3 books");
scanf ("%s %d %d ", b1.name, & b1.price,
& b1.pages ");
Array of structure :-
# include <stdio.h>
main ( )
{
struct book
{ char name[15];
int price;
int pages;
};
struct book b[100];
for (i = O; i < = 99; i++)
{
printf ("\n Enter the name, price & pages ");
scanf ("%s %d %d", b[i].name, & b[i].price, &
b[i].pages);
}
for ( i = O; i< = 99; i++)
{
printf ("%s %d %d", b[i].name, b[i].price,
b[i].pages");
}
}
Nested Structure :-
In the same way the whole structure can be declared within another.
the value of a structure variable can be assigned to another structure
variable of the same type using the assignment operator.
# include<stdio.h>
main ( )
{
struct employee
{ char name [10];
int age;
float salary: };
struct employee e1 = {"Shrishti",
29,80000};
struct employee e2,e3;
strepy (e2.name,e1.name);
e2.age = e1.age;
e2.salary = e1.salary;
OR
The above program will set and print same data for the entire three
variables.
FUNCTIONS
Sometimes it is required to execute a group of statement in a
program multiple times at different situation.E.g. if we need to
perform the addition of two numbers multiple times in the program,
for this we have to write the same code for numbers of times in the
program. This increases the program length and reduces the program
efficiency. To overcome this function concept is used.
Library functions:-
# include<stdio.h>
# include<ctype.h>
# include<string.h>
main ( )
{
char str[20];
int i;
printf ("\n Enter a string:");
gets (str);
for (i = 0; i<strlen (str); i++)
{
if (str[i] > =97 && str[i] < 123)
printf ("%c", toupper
(str[i]) );
else
printf ("%c", tolower
(str[i]) );
}
}
Example :-
printline ( )
{
int i;
for (i = 1; i< 30; i++)
printf ("-");
}
main ( )
{
printline ( );
printf ("\n This program says c function \n");
printline ( );
}
printline ( )
{
int i;
for (i=1; i<40; i++)
{
printf ("-");
}
printf ("\n");
As you know, the program execution always begins with the main
function. During execution of the main, the first statement
encountered is printline ( ); which indicates that the function is to be
executed. A function gets called when the function name is followed
by a semicolon. As this point, the program control gets transferred to
the function printline ( ). After executing the function a line of 30
characters length will gets printed. The control is transferred back to
the main, now the execution continues with the statement next to
printline. After executing the printf ( ) function the control is again
transferred to the
printline ( ) and the line gets printed once more. Here printline ( ) is a
called function and main ( ) is a calling function.
All parts are not essential. For example, the argument list and its
associated argument declaration part is optional. The declaration of
local variable is required only when any local variable are used in
the function. In the example discussed in the previous section, the
main does not required any local variables, while the printline ( )
function used one local variables i.e. A function can have any
number of executable statements. A function that does nothing may
not include any executed statement at all. The return statement is the
mechanism for returning a value of the calling function. This is also
an optional statement. It is not given; it indicates tat no value is
being returned by the function.
Writing a function in the program includes three steps.
1) Function Prototype.
2) Function Call.
3) Function Definition.
Function Prototype:-
* Function call:-
It is a statement using which the function gets executed. When a
function call gets encountered control jumps from main program to
the function definition block. After executing the function statements
it returns to the main program and execute the statement next to the
function call. We can call the function anywhere in any function or
program. A function can also be called into itself; this is known as
'Recursion'.
Function Definition:-
In the function definition we have to write the code for that function.
The function definition must be outside any function or it can be in
the other program also. We can call the same function for number of
times in the program. We can call or define more than one function
in a single program in a random sequence. The function definition
statement should match with the function prototype statement.
Category of functions:-
Void function:-
Void Function
Example 1:-
# include <stdio.h>
void add ( ); >
Function Prototype
main ( )
{
clrscr ( ); > Function Call
add ( );
getch ( );
}
Void add ( ) >
Function Definition
{
int a, b, c;
printf ("\n Enter two numbers:");
scanf ("%d %d", & a, & b);
c = a + b;
printf ("\n Addition = %d", c);
}
Here add ( ) is a user defined function that will perform the addition
of two numbers. It is a void function, which does not take or return
any value. Void add ( ): is the prototype statement of the function. It
is called in the main ( ) function and it is defined below the main
function It can be called anywhere in the program.
# include<stdio.h>
void upper ( );
main ( )
{
clrscr ( );
upper ( );
getch ( );
}
void upper ( )
{
char str[50];
int i;
printf ("\n Enter a string :");
gets (str);
for (i=O; i<strlen (str); i++)
{ if (str[i] >=97 && str[i] < 123)
{ str[i] = str[i] - 32; }
}
print ("\n String in upper case : %s",
str);
getch ( );
}
We could make the calling function to read data from the user and
pass it on to the called function .This approach seems to be because
the calling functions can check for the validity of data if necessary
before it is handed over to the called function.
There are actual and format arguments. Actual arguments are the one
that are passed to the called function e.g. a in above example and
format arguments are the one that are given in the called function to
store the value passed from function. They should match in their data
type and order.
Parameter Passing:-
Call by value:-
Call by reference:-
# include<stdio.h>
void add (int, int);
main ( )
{
int a, b;
printf ("Enter two numbers:");
scanf ("%d %d", & a, & b);
add (a, b);
getch ( );
}
void add ( int x , int y )
{
int c;
c = x+y;
printf ("Addition of %d and %d is = %d",
x , y , c);
}
Like the values of simple variable it is also possible to pass the value
of an array to a function. Entire array can not be passed directly to
the function. It can be passed element by element.
# include<stdio.h>
# include<conio.h>
void show (int);
main ( )
{
int n[5] = { 10 , 20, 30, 40, 50};
int i;
for (i = O; i<5; i++)
{
show (n [i]);
}
getch ( );
}
void show (int k)
{
printf ("\n %d", k);
}
{ }
The function largest is defined with two arguments, the array name
and the size of the array to specify the number of element in the
array. The declaration of the normal argument array is made as
follows:
float array [ ];
The pair of brackets informs the compiler that the argument array is
an array of number . It is not necessary to specify the size of the
array here. Another way to pass an entire array to the called function
at a time is using pointer.
# include<stdio.h>
float largest (float [ ], int);
main ( )
{
float num [4] = {2, 5, - 4.75, 13.67, 4.20 };
printf ("\n Largest number is = %.2f", largest
(num,4));
}
float largest (float a[ ], int n)
{
int i;
float max = 0;
for (i=0; i< n; i++)
{ if (a[i] > max )
max = a[i];
}
return (max);
}
POINTERS
Consider the declaration
int i = 3;
Location
Number 6485
3 Value at
Location I
Location
Name
See that computer has selected memory location 6485 as the place to
store the value 3 & it is i's address in a memory. In general programs
whenever a variable is used in any statement, to access its value we
have to search the memory by the variable name. This requires lot of
time when there is large amount of data to be accessed like structure,
arrays etc. Every time the variable is encountered it has to be
searched in the memory. To reduce this time Pointers can be used.
Declaration of pointers :-
Syntax :-
Datatype *pointername;
Example :-
int *p;
char *str;
Using Pointers the value can be accessed by its address i.e. 6485 in
above example. We can print this address through the following
program.
Address of i = 6485
Value of i = 3
'&' is used to take the address of variable and '*' is used to get the
value stored at a particular address. The value at address operator is
also called "indirection" operator.
# include<stdio.h>
main ( )
{
int i =3;
int *p;
printf ("\n Address of i = %u", & i);
printf ("\n Address of i = %u", p);
printf ("\n Value of i = %d", i);
printf ("\n Value of i = %d", * (& i));
printf ("\n Value of i = %d", *p);
getch ( );
}
Output:-
Address of i = 6485.
Address of i = 6485.
Value of i = 3
Value of i = 3
Value of i = 3
Note that printing the values of "*(&i)" is same as printing the value
of "i" as '*' refers to the value at the address given using '&i'.
Example:-
p = & i;
6485
6530
3
I 6485
P
Memory map
Pointer to function:-
In the call by value method the value of each argument in the calling
function is copied to the corresponding formal arguments of the
called function. With this method the changes made to the format
arguments in the called function will not affect to the values of actual
arguments in the calling function. That is in this method original
values will not be updated by the function.
# include<stdio.h>
main ( )
{
int a = 10, b =20;
printf ("\n A = %d B = %d", a,b);
swap (&a,&b);
printf ("\n A = %d B = %d", a,b);
}
swap (int *p, int*q)
{
int t;
t = *p;
*p = *q;
*q = t;
printf ("\n A = %d B = %d", *p, *q);
}
Pointer to structures:-
Syntax:-
Structure pointer -> structure member
Pointer to function:-
# include<stdio.h>
void display (int *. int);
main ( )
{
int n[5] = {10, 20, 30, 40, 50};
display (& n[0], 5);
}
display (int *p, int k)
{ int i;
for (i=0; i<k; i++)
{ printf ("\n %d", *p);
p++; /* Pointer pointing to next
memory location*/
}
}
On specifying the name of the array we can get its base address i.e.
address of 0th element. An array name itself refers to its base
address. Thus following &n[0] and n will refer to the same element
i.e. 0th element. Thus by saying *n we would be able to access the
0th element of the array. That means an array name itself acts as a
pointer and it can also be used to access the array elements using
pointer. Similarly by saying *(n+1) we can refer to the first element
of the array and so on. That is n[i] is same as *(n+i). This concept
can be used to handle strings (character arrays or two dimensional
arrays easily.
# include<stdio.h>
# include<string.h>
main ( )
{
char str[25];
int i;
printf ("\n Enter a string:");
gets(str);
for (i=0; i<strlen (str); i++)
{
printf ("%c", * (str +i));
}
}
# include<stdio.h>
# include<string.h>
main ( )
{
char str[30];
int i;
printf ("\n Enter any string :");
gets (str);
for (i=0; i<strlen(str); i++)
{
if (*(str +i) >= 97 && *(str + i) <123)
printf ("%c", *(str +i) - 32);
else
printf ("%c", *(str + i));
}
}
FILE MANAGEMENT
The function such as scanf ( ) and printf ( ) are used to read and
write data. These are the console input / output functions used to
perform input / output operations, which always use the terminal
keyboard and screen as the target place. This works line by line as
the data is small. However many real-life problems involve large
volumes of data and in such situations, the console oriented I/O
operations cause two major problems.
High level I/O functions are more commonly used in C programs for
file operations because they do their own buffer management.
Following is a list of operations that can be performed on a file.
Naming a file.
Opening a file.
Reading data from a file.
Writing data to a file.
Closing a file.
Syntax:-
FILE pointer name;
Example:-
FILE *fp;
Each file will have its own FILE structure. The FILE structure
contains information about the file being used like its current size, its
location in memory. It contains a character pointer which points to a
location in file. Further this pointer is used to open access or close
the file.
Opening a File:-
Syntax:-
Fopen ("filename"," mode of opening");
Example:-
FILE *fp;
fp = fopen ("data", "r");
fopen ( ) will open the file "data" in read mode. The function takes
two arguments.1) name of the file to be opened. 2) mode of opening.
It tells the compiler in which mode the file should be opened. File
can be opened in following different modes:-
Write mode allows to write the data to the file, the specification used
is "w".Read mode is used to read the data from the file specification
used is "r". Append mode allows to append new data to the end of
file i.e. previous data will not be lost. Specification is "a".
e.g.
fp = fopen ("student", "r");
The fopen ( ) function searches the file in the current hard disk
location. If it is present, it loads it into the memory otherwise it
returns NULL. For "w" mode, if the file exists, its contents get
overwritten. If file doesn't exist, a new file is created. If a file is
opened in "w' mode, it doesn't allow to read the data.
Note: - Here both the filename and mode are specified as string.
They should be enclosed in double quotation marks.
Closing a file:-
Syntax:-
fclose (file pointer);
e.g.:-
fclose (fp);
Once the file is opened, its contents are stored into the memory and a
pointer is set to the first character of the file. The first two simple
functions to read or write data to the file are :-
Syntax:-
putc (char expression., file pointer);
# include<stdio.h>
# include<string.h>
main ( )
{
FILE *fp;
char str[30];
int i=0;
strepy (str, "Happy Diwali");
fp = fopen ( "text", "w");
while (i< strlen (str) )
{ pute (str[i], fp);
i++;
}
fclose (fp);
getch ( );
}
Here fopen ( ) will open the file "text" in write mode and set the file
pointer fp to its zero position. putc ( ) function writes the array
characters element by element to the file. Finally the file will be
closed. The file gets stored permanently on the hard disk. To check
whether the characters are stored in the file, you can display the
contents of file from DOS prompt using the DOS :- type command
or you can write another program to read the contents of file.
getc ( ) function reads a single character from the file. It returns the
character from the current file pointers.
Syntax :-
getc (file pointer);
Example :-
char ch;
ch = getc (fp);
getc ( ) will read one character from the file specified by the pointer
i.e. fp and returns it to the variable ch.
getc (fp) reads a single character at a time from the file. The
program contains one new statement i.e. EOF keyword. The last
position in the file is known as end of file (EOF) position. The
characters will be taken up to end of file. The file will be closed
using fclose ( ). Similarly C provides two more functions fgetc ( )
and fputc ( ) to read and write character data to the file.
Note :-
when getc ( ) reads the character from the file, the pointer will be
automatically advanced (incremented to next position. So there is no
need to increment the pointer as i++ is given in the previous
example.
# include<stdio.h>
main ( )
{
FILE *f1;
char c;
printf ("Enter some characters:");
f1 = fopen ("Input", "w");
while ((c = getchar ( ) ) ! = EOF)
{ putc (c, f1); }
fclsose (f1);
printf ("\n Data stored in the file : \n");
f1 = fopen ("Input", "r");
while ( (c = getc(f1)) ! = EOF)
{ printf ("%c",c); }
fclose (f1);
getch ( );
}
Output :-
Here p1 and p2 are the file pointers used to handle two files at a
time. Student file will be opened in read mode with p1 and decimal
file will be opened in write mode with p2.
The getw ( ) & putw ( ) are number oriented functions. They are
similar to the getc ( ) and putc ( ) functions and are used to read &
write numeric data. The general forms of getw ( ) & putw ( ) are :
# include<stdio.h>
# include<conio.h>
main ( )
{
FILE *fp;
int n;
fp = fopen ("num","w");
for (n=1; n<=10; n++)
{
putw (n, fp);
}
fclose (fp);
getch ( );
}
Syntax:-
fprintf (output stream, "format string", variable list);
Syntax:-
fscanf (input stream,"format strings", & variable list);
In above program the first fprintf ( ) function will write the data to
screen as "Enter eno, name, & salary for the employee". fscanf ( )
will read the data through keyboard and then it will be written to the
file using next fprintf ( ) function. Then file will be opened into read
mode and fscanf ( ) function will read the data from file.
In random file handling data can be accessed randomly from the file.
We can move file pointer to any position in the file to access the
data. C provides various functions to manipulate the file pointer.
Following are some pointer manipulation functions :-
i) fseek ( )
ii) ftell ( )
iii) feof ( )
iv) rewind ( )
Fseek ( ) :-
Syntax :-
fseek (file pointer, offset, position)
Example:-
21 - moves the pointer two positions ahead.
-51- moves the pointer five positions ahead.
There are three fixed positions in the file which can be specified as a
third argument for fseek ( ) function.
These positions are:-
0 :- Beginning of file.
1 :- Current position in file.
2 :- End of file.
Example:-
feof ( ):-
Syntax:-
feof (filepointer);
Example:-
feof (fp);
rewind ( ):-
rewind ( ) sets the file pointer back to the beginning of file from any
position. It takes one argument - file pointer
Syntax:-
rewind (filepointer);
e.g.:-
rewind (fp);
# include<stdio.h>
# include<conio.h>
main ( )
{
FILE *fp;
char ch;
long n;
clrscr ( );
n = 01; / / Sets the value is 0,'1' is the long datatype
specification.
fp = fopen ("text","w");
while ( (ch = getchar ( )) ! = EOF)
{
putc (ch, fp);
}
fclose (fp);
fp = fopen ("text","r");
while (!feof (fp))
{
printf ("\n %c is at %d position ", getc(fp), fell(fp) );
n--- n | 2|; / / Incrementing the value of n by 2.
fseek (fp, n, 0); / / moves the file pointer two positions
ahead.
}
fclose (fp);
getch ( );
}
The above program will accept data from user using getchar ( )
function. To stop accepting data press F6 key this is recognized by
EOF keyword. Then it will print the characters from the alternate
positions as 0,2,4 etc. fseek ( ) function moves the file pointer two
positions ahead for every iteration. Once it reaches to the EOF, the
loop will be terminated. Position the file is a long type of value so 'I'
for long specification is used.
Syntax :-
main (int arge, char *argv [ ] )
# include<stdio.h>
# include<stdlib.h>
main (int argc, char *argv [ ])
{
FILE *fp;
char ch;
fp = fopen (argv[1],"w");
if (argc ! =2)
{
printf ("\n Invalid number of
arguments !");
exit (0);
}
while ( (ch = getchar ( ) ) ! = EOF)
{ putc (ch , fp);
fclose (fp);
printf ("\n One file is copied !");
getch ( );
}
# include<stdio.h>
# include <stdlib.h>
main (int argc, char *argv [ ])
{
FILE *fp, *fp1;
char ch;
fp = fopen (argv[1],"r");
fp1 = fopen (argv[2],"w");
if (argc ! =3)
{
printf ("\n Invalid no. of arguments!");
exist (0);
}
while (ch = getc (fp)) ! = EOF)
{
putc (ch, fp1);
}
fclose all ( );
printf ("\n One file is copied !");
getch ( );
}
GRAPHICS
Computer Graphics is one of the most powerful and interesting
feature of computer. It allows you to draw something. All video
games, animation, multimedia works using computer graphics. This
chapter describes how these things are achieved in C.
C provides various in built standard library graphics functions
that can be used to perform different operations. These functions are
defined in the header file Graphics. It contains the definitions of all
the graphics functions. Before starting the graphics application first
let's learn something about the graphics mode. There are two modes
in computer.
# include<stdio.h>
# include<graphich.h>
main ( )
{
int gdriver = DETECT, gmode;
initgraph (&gdriver, &gmode," ");
setcolor (RED);
circle (100,150, 50);
closegraph ( );
}
Syntax:-
Circle (x position, y position, radius)
First two arguments are the x , y coordinates from where the circle
will be drawn on screen. Third argument is the radius fro the circle.
You can use a variable as a argument.
Example:-
a = 20
circle (200, 300, a);
screen coordinates.
# include<stdio.h>
# include<graphics.h>
main ( )
{
int gdriver = DETECT, gmode;
initgraph (&gdriver, &gmode." "); / / Initialises graphics.
clearviewport ( ); / / Clears the
graphics screen.
setbkcolor (CYAN);
setcolor (BLUE);
circle (300, 260, 60);
ellipse (275, 240, 10, 360, 8, 13);
ellipse (325, 240, 10, 360, 8, 13);
line (300, 240, 295, 270);
line (295, 270, 303, 269);
arc (300, 280, 182, 1, 20);
fillellipse (275, 245, 5, 9);
fillellipse (325, 245, 5, 9);
getch ( );
closegraph ( ); / / Closes(deinitialises)
graphics screen.
}
# include<graphics.h>
# include<conio.h>
main ( )
{
int gdriver = DETECT, gmode;
initgraph (&gdriver, &gmode," ");
clearviewport ( );
fillellipse (280, 240, 104, 130);
setcolor (1);
ellipse (280, 240, 1, 360, 95, 120);
setfillstyle (SOLIE_FILL, 9);
fillellipse (279, 240,5, 5);
line (279, 135, 279, 240);
line (240, 178, 280, 240);
line (279, 239, 355, 270);
outtextxy (275, 125, "12");
outtextxy (365, 235, "3");
outtextxy( 190, 236, "9");
outtextxy (270, 350, "6");
fillellipse (199, 190, 2, 2);
fillellipse (223, 151, 2, 2);
fillellipse (360, 199, 2, 2);
fillellipse (338, 151, 2, 2);
fillellipse (199, 291, 2, 2);
fillellipse (225, 332, 2, 2);
fillellipse (360, 291, 2, 2);
fillellipse (337, 330, 2, 2);
getch ( );
closegraph ( );
}
PROGRAMMING IN C++ LANGUAGE
Looping Structure in C++:-
Data
Member fan
1) Class
2) Object
3) Inheritance
4) Reusability
5) Facility of creating new data type
6) Polymorphism and overloading.
1) Class:-
2) Object:-
:
:
class vivek
{
private:
int fees;
public:
void accept_fees (void)
{
cout<<"Enter fees";
cin>> fees;
}
void show_fees (void)
{
cout<<"college fees is";
<<fees<<endl;
}
};
The object "nis" gets its own private memory to place its data
member "fees" and member functions"accept_fees ( )".As we have
declared one object "nis" of class "vivek". We can declare as many
objects as we want. All these objects enjoy their own private
memories to place their own data members and member functions.
Consider the following declarative statement.
Here all the objects ob1 to ob7 belongs to the same class "vivek" and
so we can also say that all these objects together are making a class
named "vivek". Thus a group of objects can also be considered as a
class.
3) Inheritance:-
4) Reusability:-
The program is stared with # include files the file form the
library can be used with help off # include structure .
The c out & c in is used in the C++ program. Consider once
statement of program.
# include <iostream.h>
void main ( )
{
char str[40]
int M1, M2, M3, avg;
cout << “Enter your name.”;
cin >> std;
cout << “Enter marks of three subjects”;
cin >> M1+M2+ M3;
avg = M1+M2+ M3/3;
cout << “Your name is”<<std;
cout << “ You Average marks are”<<avg;
}
Syntax:-
cout << “Enter your name”;
Syntax:-
cin >> M1>>M2>>M3;
Void Pointer:-
Loops :-
1) While Loop:-
Syntax :-
While (Char !=x)
{
Body of loop cout << “Enter any character”;
cin >> ch;
}
(braces)
False
Go back to Condition
Exit while loop
revaluate
True
Execute statement
2) Do Loop :-
do
{
cout << “Enter any character”;
cin >> ch;
cout << L-nd/n;
}
while (ch !=x)
Execute Statement
Loop
False
Exist while Condition
loop
Go back to
revaluate
The Do loop is only loop that is end with semicolon the semicolon is
necessary because of the condition follows the loop a body so the
closing brace of the loop can not act end line for the entire loop.
3) For Loop :-
1) Initialization expression.
2) Test expression.
3) Increment / Decrement expression .
for e.g.
for (i=1; i<=20; ++i)
cout << "*";
int k , total = 0;
for (i=0; i<10; ++i)
{
total = total + i ;
cout = total ;
}
Decision Loop :-
i) If Statement :-
{
If (Door = "open")
cout << "Enter in class";
}
If (marks>35)
{
cout << "Result = Pass";
else
cout << "Result = Fail";
}
If (Marathi>35)
{
cout << "Result = Pass";
else
If (Hindi>35)
cout << "Pass";
else
{
If (Phy>35)
cout << "Pass";
else
{
cout << "Result = Fail ";
}
}
}
UNIX
UNIX COMMAND:-
1) Kernal:-
2) Shell:-
the shell. Act as middle man between kernal & User operating
system.
The outer most layer of Unix operating system is it's tools &
applications some versions of UNIX are having more than four
hundred tools these tools can be involved from the command line &
helps to perform complex task of te system tools consist many
applications programs which may be purses speciously such as
electronic spread sheet sophisticated word processing package.
1) $ Date:-
This command tells Unix system to print system date & time
every Unix command must be ended with Return the inform system
that user has finish typing $who.
2) $ Who:-
This command gives information about. The all users who are
currently logged on the system.
System: - $ Who
3) $ Who am I:-
This command used to get inforation about the user who is setting or
currently logged on the system
Syntax: - $ who am I
e.g. :- $ who am I
4) Echo:-
5) $ ps (prace ss status) :-
Syntax:- $ ps.
6) $ Clear:-
This command will clear the screen & view make true of command
press of word & tress new known name trace of the command
directory commands.
This command returns the path of currents directly within the root
directory their is a sub directory known as USR , within which there
is another directory it is known as user.
Syntax: - $ Rmdir
e.g.:- $ Rmdir ABC
Syntax: - $ LS
Example: - $ LS
3) Rm (Remove file):-
4) CP (Copy):-
Syntax: - $ CP (Source-target)
e.g.:- CP ABC XYZ
5) MV :- (Method Vehicle)
UNIX EDITOR:-
1) Write:-
2) Mesg Command:-
Syntax: - $ mesg x
3) News:-
Syntax: - $ news
4) WX:-
Option
I - Count line.
W- Count word.
C- Count Char.
5) Pq ( paiqinator) :-
6) Sort:-
The contains of file / & file 2 are merge, stored & redirected
to file 3
7) Cut:-
This command is used to cut out selected fields from a file &
display. The syntax of cut command is below.
Paste:-
The paste merges the contains of multiple file & display them
and screen this fielder is used to generate output in column format
the syntax is
Tar Command:-
The Tar stand for take achieved the Tar command is used for
making a back up copy of entired directory it takes as its argument a
command a directory to be achived on a tape or other tape
Ctrl + D
Path:-
Characteristics of Shell:-
1) Multi tasking.
2) Multi-user.
3) System Portability.
4) Communication:-
5) System security:-
1) Multitasking:-
2) Multi user:-
3) System portability:-
4) Communication:-
5) System Security:-
Database Environment:-
Data:-
Information:-
1) FoxPro
2) Oracle
3) Ms-Access
FOXPRO
INTROEDUCTION TO FOXPRO:-
PROGRAM:-
SOFTWARE:-
1) Application software.
2) System software.
PACKAGE LANGUAGE
It is application software It is a system software
Here a limited set of instruction used It is used for communication purpose
It is slower compared to language It is faster
e.g. Word-star, Lotus, account package, e.g. Basic , Cobol , C , Fortran , Pascal
FoxPro , D.T.P. package
DATA BASE:-
DATA FIELD:-
DATA RECORD:-
RECORD FIELD
Record is a collection of related fields Individual entity in the database is called as
fields
Collection of records constitute Collection of fields constitutes a record
e.g. Roll-no, Name, Course, fees is a record Name, Roll-no, Course, fees are the separate
of single student fields.
DATA BASE
TYPES OF FILES:-
1) Character Field:-
2) Numeric Field:-
3) Date Field:-
When you use data in your file, use this field to store data
type information.
4) Memo Field:-
5) Logical field:-
6) Float Field:-
WHAT IS FOXPRO?
ADVANTAGES OF FOXPRO:-
8) The records can be arranged order i.e. the record can be sorted, or
indexed.s
MODES OF OPERATION:-
2) Programming Mode:-
3) Assist Mode:-
INSTRUCTION SET:-
1) Command:-
2) Functions:-
3) Statement:-
FOXPRO SCREEN:-
1) Command Window
2) Menu mode
3) Status line
1) Command Window:-
2) Menu Mode:-
All the menus are displayed at the top of the screen and a
single character is high lighted to switch over to menu mode, use Alt
and highlighted character.
Then it displays the commands available in the menu. To
execute any command from the menu, move the cursor to that option
and then press enter.
3) Status Line:-
c) The total no. of records in the DBF and the position of record
pointer.
d) Status of special keys like insert, num lock, caps lock etc.
OPERATORS IN FOXPRO:-
1) Mathematical Operators:-
These are +, -, *, /
2) Relational Operators:-
3) Logical Operators:-
COMMANDS IN FOXPRO
CREATE:-
After this command, we will get the screen where you have
to provide information about the field of DBF.
Type "y" or select yes to input the data records in a file. Then enter
the record in the file and use 'Ctrl +W' key to save the file.
LIST:-
Syntax: - LIST
This will display the list which contains the name starting from A.
This will display the list which contain the record having salary
>1000 .AND.
Name = "A"
This will display the list which contains the record having salary,
1000 or name starting with "A".
USE:-
Syntax: - USE
QUIT:-
Syntax: - QUIT
CLEAR:-
APPEND:-
Syntax: - APPENED.
APPENED BALNK:-
RECORD POINTER:-
GO TO:-
GO TO TOP:-
Syntax: - GO TO TOP
GO TO BOTTOM:-
Syntax: - GO TO BOTTOM.
SKIP:-
EDIT:-
Syntax: - EDIT
E .g. EDIT 5
BROWSE:-
Syntax: - Browse
e.g.:- Use Student
Browse.
DISPLAY:-
Syntax: - DISPLAY.
DISPLAY STRUCTURE:-
MODIFY STRUCTURE:-
DELETION:-
Logical deletion:-
Physical deletion:-
DELETE:-
Syntax: - DELETE.
PACK:-
Syntax: - PACK
ZAP:-
Syntax: - ZAP
The structure of the fill will remain same only the record will
deleted.
SUM:-
It will select all records whose address are "A'bad" & add their
salaries. The result is stored into memory variable S2.
AVERAGE:-
COUNT:-
It will count all the records whose address is "A'BAD" & result is
stored in S2.
CALCULATE:-
SEARCHING TECHNIQUES
Following techniques are used to search particular record satisfying
certain condition from the DBF.
1) Locate
2) Seek
3) Filter
It returns you the rec.no. having city "A'BAD" i.e. it will search for
that field. This command is used to search and unindexed single
record.
If you want to search the next rec. that matches the criterion then
give CONTINUE command after LOCATE command.
CONTINUE:-
Syntax: - CONTINUE
SEEK:-
DISPLAY
INDEX ON Salary to S
SEEK 5000
DISPLAY
FILTER:-
REPLACE:-
REPLACE ALL:-
It will replace all the record in the specified feld with the new
expression in a entire DBF.
DELETE FILE:-
COPY TO:-
This command is used only with DBF the new file will have the
extension DBF.
COPY STRUCTURE:-
COPY FILE:-
This command is used to copy the contents of any file into a
new file.
This is similar with copy command in DOS.
RENAME:-
SORT:-
New file created is a database file. Here the sorted record will be in
file student. To see those records, you will have to use that file i.e.
student and then give LIST command. The sort command will sort
the data which was randomly entered.
You can open the sorted field files using "Use" command.
You can sort the file on multiple fields also. When entries in the first
KEY field are same then second key field determines the order.
USE Trial
Here name is primary & city is secondary KEY Field for sorting the
database file TRIAL, CITY.DBF gets created. To see the Sorted
records. We should open sorted file.
USE CITY.
INTRODUCTION TO INDEX
name. Here the field containing the name of the employee would be
called the KEY field.
1) Simple Index.
2) Compound Index.
In simple index file, the FoxPro creates a separate index file for each
KEY Field.
This index file will have the extension .IDX. The index file will
contain information about the KEY fields & the location of data in
the database. When the database file is opened using the USE
command, the corresponding index file will also have to be opened.
2) To index EMPDATA.DBF
We select file menu & select NEW from the sub-options. The new
dialog box will displayed.
3) Select index file radio button. The INDEX dialog box appears.
This dialog box allows you to create the index file.
4) You can select field (s) to be used as the key field from the FIEED
list box. As the fields are selected they appear in the INDEX KEY
list on the right.
The for clause make the index include only records for which the
logical expression is true.
The UNIQUE option makes the index include only records with
unique values of the key field, i.e. if a file contains more than one
record having the same KEY values then only the first record will be
indexed.
Note the EMP in the to clause will have extension.IDX & whenever
the database is opened, then the index file must also be opened,
otherwise the index file will not be updated.
To open index file along with the database file, the following
command can be entered from command window.
BROWSE
EXPRESSIONS IN INDEXES:-
REINDEX A FILE:-
We have seen that s single index file must always be opened along
with the data file, if the changes made in the data file have to be
updated in the index file. However, sometimes this may not get done.
This would result in a mismatch between the data in the index file&
the data file. However this can be corrected by using the REINDEX
command. The REINDEX command reindeers the file on the same
key as specified during the creation of the INDEX file . Note that
both the data file as well as the index file has to be opened
The file is now reindeer & the index file is updated. This command
is not necessary if the index file is already updated
COMPOUND INDEXING:-
INDEXING SORING
Organize records logically Organize records physically.
Remain record no. unchanged. Changes original record no.
Create index file. IDX or .CDX Created file for sorted records.
Allow random search also. Allow sequential search only.
Require less time to retrieve any Required more time to retrieve any
record. recode.
Allow to open index file with dbf file Cannot open sorted file with db file
Any changes in dbf will be Have to resort if any changes made in
automatically updated in index file dbf file.
Index file requires less memory Sorted file requires same memory
DISADVANTAGES OF SORT:-
ADVANTAGES OF INDEX :-
3. Index command is fast compared to sort you can use the index file
along with DBF using following syntax
Syntax Use<DDF File Name > Index<Index File Name> exg. USE
STUDENT INDEX STD 1
Here STUDEND is name of database file and STD1 is name of
index file. The database file and index file name may be same.
FIND:-
SEEK:-
This command is used with both Numeric and character type of data.
Here the character types of data must be enclosed in quotes.
SET COMMANDS
This command is used to set the status line on/off .By default status
line is on.
When you are entering the data using APPEND command and other
commands then after the selected field width is complete the cursor
will lcome to next field automatcially if it is off
When you will set the confirm ON the cursor will not come to next
line until you press ENTER. Other wise the last character in the
Field will be upgraded by default it is OFF.
Set date
When it is OFF then only it will show the logically deleted records
in the list . By default it is OFF.
It you are using the commands like list, display etc. It will show the
records depending on the tentative character.
E.g. List For Name= "G ".
This command will show the name like Geeta, Gresham etc.
If you will set the exact ON then you will have to provide the Exact
name in the command
e.g. List for name=" Geeta ". By default the exact is OFF.
This command is used to set the clock at particular row & column
e.g.set c;pcl tp 15.7
To see the date with century, set century ON. By default it is OFF
SET DEFULT TO (DRIVA/DIRECTORY)
E.g. set default toC:/Foxpro
To change logged drive or directory set default to command is used.
By this command all records with city is "A' bad" are displayed
Set filter to
By this command all records in the dbf will be displayed
To set merging while executing the command .By default left margin
is 0. The effect will be seen in printed output.
FUNCTIONS
NUMERIC FUNCTIONS. :-
1) Abs ( ):-
2) Int ( ):-
3) Log ( ):-
4) Max ( ):-
5) Min ( ) :-
6) Sqrt ( ) :-
7) Mod ( ):-
DATABASE FUNCTIONS:-
8) Round ( ):-
9) IIF ( ):-
1) Deleted ( ):-
2) Field ( ) :-
3) Recounts ( ):-
Syntax: - Recounts ( )
e.g./ reccount ( )
O/P: 6
4) Recno ( ):-
Syntax: - ? Reccount ( )
e.g.? Recno ( ) O/P:
5) Recsize ( ):-
Syntax: - Recsize ( )
e.g.? Recsize () O/P: 72
This function gives true value if record point is after the last record
at the end of file i.e. it gives true or false states about the end
of file.
DATE FUNCTIONS:-
1) DATE ( ):-
Syntax: - Date ( )
e.g.:- ? Date ( ) O/p: 25/10/98
2) DOW ( ):-
3) CDOW ( ):-
4) MONTH ( ):-
5) CMONTH ( ):-
6) Day ( ):-
7) Year ( ):-
8) CTOD ( ):-
9) DTOC ( ):-
ENVIRONMENT FUNCTIONS:-
1) DISKSPACE ( ):-
2) FILE ( ):-
3) OS ( ):-
STRING FUNCTIONS:-
1) AT ( ):-
2) LEFT ( ):-
3) RIGHT ( ):-
4) LTRIM ( ):-
5) RTRIM ( ):-
6) REPLACE ( ):-
7) SUBSTR ( ):-
8) SPACE ( ):-