Computer Basics
Computer Basics
Computer Basics
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.
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
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.
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: -
On this CD we can write and read data many times.
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
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
V) I/O Management.
2) Languages :-
Using languages we can give instructions to the
computer. These languages can be of three type.
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 language whole
programs at a time. Therefore speed to complier is faster than
speed of interpreter.
3) Utilities :-
a) Antivirus Programs :-
These programs are used to take backup of the important data
for security purpose.
b) Backup Programs :-
These programs are used to take backup of the important
data for security purpose.
c) Uninstall Programs :-
These programs are used to uninstall installed software. It
removes all files installed with corresponding software.
]
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 :-
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 (.)
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
You find the a file name try1 txt is get created on disk.
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*.* :-
Will display all files on c; whose name is starting with alphabet
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 :-
Creating a new file: -
2) Edit menu :-
4) Search menu :-
4 )View menu :-
5) Tools Menu :-
Setting :- We can make settings for printer ports and tab stop
1. Color : -
6. Help Menu : -
a) More :-
This command is used to display list of files and
directories or contents of files one screen at time . It will display more at
bottom to display next screen of file
e.g. C:\>dir|
b) 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 :-
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 :-
When we click on start menu . It will display all
programs or application in our computer as shown below.
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 :-
It is background pattern given to desk top called as
wallpaper. To change 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 :-
The icon shown is always present on desktop. To open
that right click on it and select open option form shortcut menu or
double click on the icon to open my computer. It will displays system
configuration and all drives available out computer
Recycle Bin :-
When we delete any file in windows operating
system in come in recycle Bin . We can restore all deleted files from
Recycle Bin. To restore files from recycle bin click on file menu and
click on "Restore" option. To delete files permanently from recycle bin
click on file menu and click on "Empty Recycle Bin" Option.
Calculator :-
To open Calculator Click Start-> Program -> Accessories->
Calculator
Following calculator window will appear.
Notepad :-
contains. Title bar, Menu bar, Status Bar. By default file name in
notepad is "Untitled . txt" where .txt is extension indicates that it creates
text file. Follow following window.
File Menu :-
1) Creating a new file:-
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 :-
We can help about note pad from 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 : -
This option is used to display picture in magnified form
or large size and normal size.
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: -
When this is active or having check mark picture
is selected with White paper background and when it is inactive
background is transparent.
Color Menu :-
We can edit different colors in color box used Color->
Edit colors option .
WORD PAD
Word Pad is advance software than Notepad. To open word pad
click on Start -> Program -> Accessories -> Word pad. A WordPad
window appears on screen as shown below.
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 :-
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:-
This menu is related with display of Tool bar, Format
bar, Status bar and Ruler. We can active or inactive them form view
menu by clicking on corresponding option. e.g. if Tool bar is inactive
then to active it click on View
-> Tool bar. A check mark indicates that it is active. To inactive it do
same view-> Tool bar.
Tool Bar :-
This bar also contains shortcut tools to create new file,
open existing file, save existing file, Print file to display previews also
for cut, copy, paste, undo and date/time tools .
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.
a) Click Insert -> Object
b) Select software from which you want to insert object and click on ok
button.
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 :-
We can align text in paragraph to left, right, center or
justify.
6) Indents :-
We can increase or decrease indent of selected paragraph.
7) Border :-
We can apply borders to table.
8) Highlight :-
Select color to highlight the text.
9) Font color :-
Apply selected color to selected text.
Status Bar :-
b) We can create different new files in word like template, letter or web
file. In all these option click on 'New Blank Document' in General tab
and click on OK button.
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 :-
We can save different versions of document using
Versions option if File Menu.
b) Select file name which you want to open from appropriate path and
click on Open.
5) Page Setup :-
To change page setup click on 'File->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 :-
This is used to display view of page before printing it. By
viewing the preview of document we can change the page setup
according to our requirement. Web page preview will display the
document that how it will get displayed on web page.
7) Send To :-
Using send to we can send the document to destination
using fax, using mail etc.
8) Properties :-
This option displays general properties of file and we can
set properties like read only, archive, hidden or system file.
File menu also display recently opened file also display recently
opened files and also Exit is used to close MS-Word.
1) Undo (Ctrl+Z) :-
This is used to cancel recently done action in current
document.
2) Redo (Ctrl+Y) :-
3) Moving text :-
To move text form one place to another use CUT
(Cut+X) and Paste (Ctrl+V ) in edit menu.
4) Copying Text :-
To copy text from one place to another place use Copy
(Ctrl+C) and Paste (Ctrl+V) from Edit menu.
5) Paste Special :-
6) Clear (Del) :-
8) Finding Text :-
We can find a word or text in current document using
Edit->Find.
1) Match Case :-
This matches small and capital letter.
4) Sounds Like :-
This matches pronunciation of word. Know and No are
considered as same match if sounds like is checked.
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:-
This option is used to go to particular Page, Book mark, Section,
line Footnote, or Endnote, . Enter the page no.
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:-
In this view document gets displayed in normal view. It
will not display margins of page. No separate page gets displayed like in
Print Layout. Background given to document is not visible in Normal
view. A single line gets displayed where page is braked.
b) Web Layout :-
This view displays the document, How it will appear
when it gets published on Web. Background is visible in this view. It is
also called as "On line View".
c) Print Layout :-
This view displays document with margins, indents of paragraph.
Vertical Ruler is visible in this view. Background is not visible in this
view. This view is help full in changing document setup or page setup.
This view gives idea about how .It will appear on page after printing.
Generally we always work in Print Layout.
d) Outline View:-
This view is used to display outline of document. When
we click on View->Outline, 'Outline' toolbar gets activated.
2) Tool Bars :-
To activate or deactivate various tool bars this option is
use. There are different tool bars available in MS-Word as listed below.
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 :-
This option is used to activate or deactivate vertical and
Horizontal Ruler in MS-Word.
4) Document Map :-
The Document Map is a separate pane or area that
displays a list of headings in the document. Document Map is used to
navigate thought the document . When we click on a heading in the
Document Map, Word jumps to the corresponding heading in the
document, displays it at the top of the window, and highlights the
heading in the Document Map.
7) Full Screen :-
This inactivate all too bars and display document on Full
Screen.
8) Zoom :-
This is used to display document in different magnified
form.i.e.200%,300% etc. as shown.
1) Break :-
Break option is used to insert page break, section break etc.
Text wrapping break end the current line where the cursor is
placed and move cursor to next line.
Also there are four types of section break Next page, Continuous
, Even page, Odd page.
2) Page Numbers :-
This is used to insert page numbers in document with
different format and at different locations.
a) Click Insert-> Date and Time Following window will appear. We can
select date and time format form window.
4) Symbols :-
This option is used to insert different symbols in
document.
5) Fields :-
This option is used to insert different fields in document
like date, time or different formulas. There are different 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 quickly insert text,
graphics, fields, tables, bookmarks, and other items that you use
frequently.
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 :-
Used to insert comments in your document where the
cursor is placed. the inserted comments gets displayed at bottom of
screen if 'Command' option from view menu is checked or activated. A
comment number with yellow color will appear where the comment is
placed.
8) Footnote :-
This is used to insert foot note or end note in document.
Footnote is the note which is inserted at the end of page in document.
End note is the note which is inserted at end of document.
9) Caption :-
This is used to give numbers to diagrams, tables inserted in
document.
10) Picture:-
There are six sub options in picture from Insert Menu.
We can also Insert Clip Art from Drawing Tool Bar using tool Clip art .
a) Clip Art :-
We can Insert different Clip arts from Microsoft Clip Gallery .
b) From File :-
To insert a Picture from another file like paint brush file, Corel
draw file etc.
c) Auto shapes:-
When we click on Insert->Picture->Auto shape. This will
activate Auto shape toolbar. We can insert different Auto shape from
this toolbar. We can also insert auto shape from Drawing Tool bar.
d) Word Art:-
We can insert different word art in document. Word Art
can also inserted form Drawing Tool bar using tool.
11) File :-
We can inset a document in another document.
12) Object:-
13) Bookmark :-
Bookmark is the mark inserted in document. To insert
bookmark in document.
14) Hyperlink :-
Hyperlink is the link between to document. Hypertext is the text
on which link is created. We can link two document in word using
Insert->Hyperlink.
1) Font:-
To change font, font size etc of text.
Text effect tab is used to apply different text effect like linking
background, shimmer. We can see preview in preview window.
2) Paragraph:-
To change paragraph formatting
5) Columns:-
This option is used to divide the page in columns like News
paper.
6) Change Case :-
This option is used to change the case or selected paragraph or
text.
1) Sentence Case :-
In this case first character of each sentence become capital and
all other in small letters.
2) Lower Case :-
In this case all characters appear in small case.
3) Upper Case :-
In this case all characters appear in capital letters.
4) Title Case:-
In this case first character of each word become Capital.
5) Toggle Case:-
In this case all character in Capital form appears in Small letters
and vise versa.
7) Tabs :-
This option is used to give space using tab key. It help in
creation of structure like table without border.
8) Drop Cap :-
This option is used to make first character of sentence to big
size.
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:-
To apply background to the document .
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:-
This option is used to apply different styles to the document.
Styles have predefined formatting e.g. font, font size, color, margin ,
styles and tabs etc. To apply these styles.
a) Click Format-> Styles. Following dialog will appear. Select the style
Preview of style is shown in preview window.
b) If you want to create new style click on New button. Again a new
dialog will appear. Give new name to style and to set formatting click on
format button.
c) Click on Ok button to apply the setting You will found that the new
style gets added in list of style.
2) Word Count:-
This displays the total characters with or without spaces, Total
no. of lines in document, Total no. of paragraphs and word in document.
If include Footnote and Endnote check box is checked then it include
text in footnote and endnote in counting.
3) Auto Summary:-
This option is used to summaries the document. It automatically
takes the sentences relevant to subject in summary. When we click on
Tool->Autosummary.Following dialog will appear. We can take
summary in font types.
4) Auto Correct:-
Auto correct makes some correction as you type the document as
listed below.
5) Language:-
There are three sub options in language.
1) Language:-
Sets the language which helps in spelling and grammar
checking .
2) Thesaurus:-
We can find synonyms for particular word in document.
3) Hyphenation:-
This option hyphenates the document.
6) Track Changes:-
a) This option is used to track the changes in document. Once
you saved the document. Click on Tools->Track Changes->Highlight
track changes. Activate the option to track the changes while editing.
When you edit the document the changes are highlighted in specific
form or style and comment is shown about the changes.
b) To accept the changes Click on Tools->Track Changes->Accept or
Reject the changes.
c) Compare document compares the original document with edited
document. To compare document.
7) Protect Document:-
This option is used to protect document from making changes.
To protect the document click Tools->Protect document following
dialog will appear. Select the option for which you want to protect the
document .One can protect the document from inserting new text,
deleting existing text and inserting password. Password always appears
in form of *. Click on ok button and retype the password in next
window. Click on Ok button . This makes track changes active. This
highlight all changes made in document. One can not accept or reject
these changes without unprotect the document.
8) Unprotect Document:-
To unprotect the document click on tool->Unprotect and give the
same password which is given to protect the document. After unprotect
the document one can accept or reject all track changes.
9) Mail-Merge:-
Some time we want to send same letter to different person.
Suppose we want to sent a letter to parents of students informing about
parents teacher meeting. Instead of creating multiple documents. Type a
common to letter and merge the database containing name and address
of parent in it. This will create a separate for each parent.
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:-
This is used to draw table in document. When we click on Table-
>Draw table. Table and Borders toolbar gets activated. As shown below.
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.
b) Columns to left insert columns to left side of column where the cursor
is placed.
d) Similarly we can insert rows to above and blow of the row where the
cursor is placed.
e) Cells:-
We can insert cells in table. for that we have to insert
whole row or column or we have to shift current cell to below or right of
the current cell. Click Table->Insert->Cells shows following dialog.
Specify where to shift current cell and click on Ok button to insert the
cell.
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:-
To convert single cell into multiple cells split cell is used. Click
Table -> Split cell following dialog will appear. Give no. of columns
and rows to split the cell and click on ok button.
6) Merge Cells:-
7) Spilt Cell:-
To convert single cell into multiple cells spilt cell is used. Click
Table->Spilt cell following dialog will appear. Give no. of columns and
rows to split the cell and click on ok button.
8) Auto Format:-
There are some predefined formats which we can apply to the
table using Auto format. To apply formatting to table.
9) Auto fit:-
This option is used to adjust width of column and table.
10) Convert: -
We can convert text to table and table and table to text.
11) Sort:-
Sorting means arrangement records on a particular order i.e.
ascending or descending order. We can sort table according to order to
primary key or any field in table. To sort the table. Select the table.
Click Table ->Sort. Following dialog will appear. Select the field
according to which you want to sort the table e.g.sr.no.or name and
specify the order.
Give second field for sorting. If some contents are same in sort
by field then it will get sort by then by field specified next. Specify the
order of sorting. This sort the table.
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:-
In excel type Sunday or any day name in a cell. Place mouse
pointer on fill handle and drag it. It will automatically fill name of days
in sequence as shown below. In same way we can also fill series of Jan ,
Feb , Mar etc.
3) Close:-
Click File->Close to close workbook.
4) Save as Workspace:-
Some times we want to open number of workspaces at a
time. Then we save that workbooks 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:-
We can see the page before printing called as print preview.
8) Printing Sheet:-
To print the pages or sheet click File->Print. Ctrl+P is shortcut
key for print. Following dialog will appear. Set the printer, ranges and
specify what you want to print i.e. selection, sheet or entire workbook.
Specify no, of copies to print and click on 'Pint ' button to print the page.
Edit Menu:-
1) Undo (Ctrl+Z):-
This is used to cancel the action.
2) Redo (Ctrl+Y):-
This is used to repeat the action.
4) Copy Cells:-
When we want to copy cells the select the cells click edit-
>Copy and select the cell where you want to paste. Click Edit->Paste.
5) Filling Contents:-
We can fill the contents of cell in row or column. To fill
the contents to down side then select the cell containing the value and
select the column in down or up direction and click Edit->Fill->Down or
UP. To fill the contents to left or right side then select the cell
containing the value and select the row toward left or right side and
click Edit->Fill->Left or Right.
6) Filling Series:-
To fill series select the cell containing starting value and
then click Edit->Fill->Series. Following dialog will appear.
Select rows or column where you want to fill the series. There
are four types of series.
a) Linear Series:-
In this series step value gets added in starting value or previous
values. e.g. if starting values is 2, setup value is 2 and stop value is 14
then series gets filled is 2,4,6,8,10,12,14.
b) Growth Series:-
In this series starting or previous value gets multiplied by step
values. e.g. if starting values is 3, step value is 2 and stop value is 14
then series gets filled is 3,6,12.
c) Date Series:-
In date series step value gets added in day , year or month of date
as per your selection . e.g. if starting date is 2/2/04, step value is 2 date
unit is month then series gets filled is 2/2/04,4/2/04,6/2/04,.... etc. Stop
value specifies the ending value. Click on Ok button fill the series.
7) Clear:-
There are four options.
a) All:-
This clears all i.e.formating, contents and comments.
b) Formats:-
This clears formatting of cell but content and comments remains
as it is.
c) Contents:-
This clears content of cell but formatting and comments
remains remains it is.
d) Comments:-
This clears comments but content and formatting remain as it is.
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:-
To delete current sheet Click Edit->Delete sheet.
12) Go to:-
To locate the particular cell Click Edit->Goto.Following
dialog will appear. Specify the reference or cell address that you want to
locate and click on 'Ok' button.
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:-
To display comments on screen Click View->Comments.
5) Full screen:-
To display book on full screen Click View->Full screen.
6) Custom views:-
To create different views in excel Click View->Custom views.
Following dialog will appear. Click on 'Add' button to create new view.
Give name to view. Click on 'Show' button to display book in
customized view.
1) Inserting Cells:-
Click Insert->Cells to insert new cell where the cursor is
placed. Specify whether to insert new row or column or to shift current
cell to right or down side. Click on Ok button this will insert new blank
cell instead of current cell.
2) Inserting Rows:-
To insert multiple rows or single row, Select multiple or single
row and Click Insert->row.
3) Inserting Columns:-
To insert multiple columns or single column select
multiple or single column and click Insert->Column.
4) Inserting Sheet:-
To insert sheet in book Click Insert->Worksheet. You found that
the new sheet get inserted into book before the current sheet.
5) Inserting Chart:-
We can insert chart or represent table in graphical format. To
insert chart follow give steps.
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 ( ):-
This function is used to add contents of given cell address
of given values.
b) Average ( ):-
This function is used find out average of given values or
cell contents.
c) Max ( ):-
= Max (A1:A5)
d) Min ( ):-
This function returns minimum value in given range or values.
e) Count ( ):-
This function returns no. of cells containing number values in
given range.
f)Counta ( ):-
g) Char ( ):-
This function returns character represented by given number.
h) Len ( ):-
i) Upper ( ):-
This function returns length of given string.
j) Lower ( ):-
This functions returns given string in lower letters.
Logical conditions:-
1) And ( ):-
This function returns value "True' When all given conditions are
true. All conditions are separated by Comma (,).
2) Or ( ):-
This function returns value "False' When all given conditions
are false.
3) Not ( ):-
This function returns value 'True" if given condition is false and
vice versa.
=Not (A1=35)
T T T
T
T F F
T
F T F
T
F F F
Name a cell or range. Select the cell where the formula is given
Click Insert->Name and give name to formula. To paste the formula in
another cell give = sing and name given to formula.
1) Formatting Cell:-
To format cell or cells select range or cell. Click Format-
>Cells. Following dialog will appear. There are total six tabs. Number
tab specifies alignment of text in a cell. Font tab is used to specify font,
font size, font style color of text. Border tab is used to set border of cell
or selected range. Pattern tab is used to fill different patterns in cells.
2) Formatting Rows:-
We can change height of row using Format->Row-
>Height. We can hide or unhide rows.
3) Formatting Columns:-
We can change width of column using Format->Column-
>Width. We can hide or unhide columns.
4) Formatting Sheet:-
We can change name of sheet using Format->Sheet-
>Rename. We can hide or unhide sheet in a book. We can apply
background to sheet using Format->sheet->Background.
5) Auto Format:-
Select table. We can apply different predefined formats
to table using Format->Auto format. Following window will be appear.
Select any format according to your choice and click on Ok button and
apply it to selected table.
6) Conditional Formatting:-
We can change formatting of cell or contents in cell according to
condition. To do this click Format->Conditional formatting. Following
dialog will appear. Give the condition that what should be the value of
cell. or what should be the formula in cell. Click on Format button and
Set the formatting to apply when condition gets satisfied and click on
Ok button to apply conditional formatting. To add another condition
click on Add button and to delete the condition click on Delete button.
Tools Menu:-
2) Goal Seek:-
This option is used to set value of cell to particular value by
changing the value of another cell whose reference is given in formula.
Select the cell containing formula. Click Tools->Goal seek. Following
dialog will appear. give the reference of cell containing formula in Set
Cell. Give the value in To value box (i.e. Target value) Give reference
of cell that contains the value that you want to adjust. Click on Ok
button.
3) Creating Scenarios:-
Click Tools->Scenario. Following dialog will appear. Click on
Add button. Again Edit Scenario dialog will appear Give name to
scenario and reference of cell that you want to change. Click on Ok
button. Enter values for changing cell. Click on Ok button. Click on
show button in Scenario Manager Dialog to show the scenario.
4) Auditing in Excel:-
Auditing means locating cells that proved values to formula.
Data Menu:-
1) Sort:-
This option is used to sort table in ascending or descending
order. Click Data->Sort. Following dialog will appear. Click on Header
row to display heading of row in sort by. Specify the column name and
order. This will arrange contents of column or table according to
specified column in ascending or descending order. A-Z is ascending
and Z-A is descending. To sort table according to two columns specify
second column name in .Then by box and order and click on Ok button.
2) Filter:-
Filter means way to find data quickly and easily. Filtered
list contains the data that matches given criteria. Select the list. Click
Data->Filter->Auto filter. A filter gets attached to each column in
table.i.e. Click on this down arrow or filter and specify the criteria. List
data satisfying criteria gets displayed.
3) Form:-
Select the table click Data->Form. A form containing all fields in
table gets displayed as shown below. We can add, deleted, find records
using this form in table.
4) Subtotal:-
Subtotal is used to find sum according to another value.i.e.in
following example we want to find total sale of each COM. separately.
Then sort the table according to comp name then Click Data->Subtotal.
Following dialog will appear. Specify column 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.
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:-
This is used to apply some condition to check entered data is
valid or invalid. Select the range where you want to
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:-
Consolidate is used to add values in corresponding cell from
different references on different sheet. Click Data->Consolidate.
Following dialog will appear. Select range of cell as
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:-
Pivot table is gives all summary reports or reports according to
our choice. Consider following table.
Freeze Pane:-
Freeze Pane freeze left and up area of selected cell.
INTRODUCTION TO MS-POWERPOINT
2) Design Template:-
If we want to apply a template to blank presentation the select
design Template option from above window or click on File->New-
>Select Design template tab from new window.
4) Blank Presentation:-
This option is used to create presentation according to your own.
A Following dialog will appear which ask for slide layout. Select the
slide layout. There are 24 layouts available. Click on Ok button to insert
the slide and presentation. A presentation is collection of no. of slides.
Saving Presentation:-
a) Save as:-
As we have seen in Ms-Word to save a new presentation with
new name Click on File->Save As. Give name to presentation. By
default in PowerPoint presentation name is 'Presentation1.ppt' where
.ppt is extension.
b) Save:-
To save modification in PowerPoint Click File->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:-
To edit or modify Edit Menu is used. There are some option like
undo, redo some as in Ms Word.
a) To Move this slide or object on slide select the object or slide, Click
Edit->Cut and place the cursor where you want to paste or move the
slide or object and click Edit->Paste.
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:-
To make duplicate slide of current slide Click Edit->Duplicate.
Viewing Presentation:-
View menu contains all the options which allows to display
presentation in different formats.
1) Views in PowerPoint:-
There are font views available in PowerPoint
a) Normal:-
In Normal View three areas gets appeared on screen. They are
called as pane i.e. Outline pane, Slide pane and Notes pane. Outline
pane shows outline view of slides or all text on slide. Slide pane shows
how the contents of slide appear in slide show and Notes pane contains
the notes of r speaker. By default any view Click View->Normal or
press Normal view tool given at down left corner of screen .
d) Slide Show:-
This is used to show slides on full screen.
a) Slide Master:-
Click View->Master->Slide Master. Following master slide
appear on the screen. Here we can set Date, Footer and Slide Number on
slide. Also we can set format of title on style and objects on slide. the
object or background given to slide master will get automatically
applied to all slides in presentation.
b) Handout Master :-
To set settings for handout (no. of slides on one page) Click
View->Master->Handout. Following Master handout will appear on
screen. Also Handout Master toolbar will on screen. Set header area,
date Area, Footer area and Numbers area. Also set numbers of slides on
handout from handout master tool bar.
2) Slide Miniature:-
This displays slide miniature window as shown below on screen.
Click->View ->Slide Miniature. This option is active only in Notes page
view.]
5) Comment:-
This is used to show comments on screen.
6) Zoom:-
This is used to show presentation in maximize or minimize view.
Insert Menu:-
3) Comment:-
To insert comment on slide click Insert->Comment.
6) Insert Table:-
1) Font:-
As we have seen in Ms-Word we can change font, font style of
text on slide. We can apply effect like shadow, underline, superscript,
emboss, subscript and color.
a) Select the text; click Format->Font Font dialog will appear. Make the
settings and click on Ok to apply the settings.
3) Alignment:-
We can align the text to center, left, right using Format->align.
4) Line Spacing:-
To change spacing between two lines of paragraph, spacing
before paragraph and after paragraph Click Format->Line Spacing
Following dialog will appear. 'Click on Ok' button to apply the settings.
5) Change Case:-
We can convert selected text in Title, Sentence, and Upper,
Lower or Toggal case using Format -> Change.
6) Replace Font:-
This is used to replace selected font with another font. Click
Format->Replace Font. Following dialog will appear. Select with which
font you want to replace existing font. Click 'Replace' button to apply
changes.
7) Slide Layout:-
To change layout of exiting slide select the slide Click Format-
>Slide Layout. Following dialog will appear. Select layout and click
'Reply' button to apply new slide layout.
9) Background:-
To change background of slide click Format->Background.
Following dialog will appear. To change color of back ground click on
combo box and select color from 'More color' and to fill different pattern
Click 'Fill pattern' Following dialog will appear. There are four tabs.
'Gradient' tab is used to apply shading of two or more colors. 'Texture'
tab is used to apply different textures. 'Pattern' tab is used to apply
different pattern and 'Picture' tab is used to apply picture to background
of slide. Click on 'Ok' button to apply the settings.
Select the template from design available and click on 'Apply' button to
apply the settings.
1) Hide Slide:-
To hide a particular slide in presentation select the slide and
click Slide Show->Hide slide.
2) View Show:-
To display presentation on full screen Click Slide show->View
show. F5 is shortcut key to display presentation on full screen.
3) Rehearsal Timings:-
Click slide show->Rehearsal Timings following tool bar will
appear while presentation. It shows time required by current slide in
presentation and total time required by presentation.
4) Set up Shows:-
5) Custom Shows:-
We can select slides from presentation can create different shows
in power point Click Slide show->Custom shows. Following dialog will
appear. Click on 'New' button to create new show.
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:-
To navigate through the presentation action buttons are used.
There are nine actions button given to go to next slide back slide, first
slide, and last slide. We can introduce new presentation in existing
presentation using this action button. Click Slide Show->Action buttons.
Drag and drop action button on slide as shown below.
Following action settings dialog will appear. Select the hyper link
to which slide and click on Ok button to apply the settings. Click on this
button to go to last slide slide during presentation show.
INTRODUCTION
Language:-
The language is the way of communication between two persons.
• C-Language:-
It gives the bas for communication between user and computer
or the user and programmer.
• Advantage:-
e.g.:- C Language.
History of 'C':-
By 1960 a crowd of computer has come into existence, almost
each for a specific purpose e.g. COBOL has being used for commercial
application, FORTAN for engineering application. At this stage, people
started thinking the instead of suing different language which can
program all possible application. Therefore an international committee
was set to develop such a language Table. Shorts the various stages in
evolution of language.
Introduction to 'C':-
C is programming language developed at AT & T's Bell
Laboratories of USA in 1972. It was designed and written by Dennis
Ritchie. C is often called a middle level language.
Importance of C:-
The increasing popularity of C is probable due to its many
desirable qualities. It is a robust language whose rich set of built in
functions & operations can be used to write any complex program. The
C compiler combines the capabilities of an assembly language with the
features of a high level language & therefore it is well suited for writing
both system software & business package and so it is called as a middle
level language. Programs written in C are efficient & fast . C is highly
portable. Another important feature of C is its ability to extend itself. A
C program is basically collection of functions that are supported by the
C library. We can continuously add out functions to C.
Types of Constants:-
C Constants can be divided into two major categories.
1) Primary Constants.
2) Secondary 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:-
There are basically four types of Instructions in 'C'.
Arithmetic Instructions:-
To perform arithmetic operations between constants and
variables.
• Control Instructions:-
• Linking.
• Constant declaration.
• Global variable declaration.
• Main ( ) function.
• Local variable declaration.
• Input statement.
• Calculation or processing.
• Output statement.
• User defined functions.
Linking:-
C uses various built in functions to perform the operations. They
are also known as standard library function which are defined in
different header files. To use a particular function, the respective header
file should be included in the program. When the program is executed,
the file gets linked to the program.
1) Stdio.h:-
2) Conio .h:-
3) Math.h:-
Mathematical functions. Example: - sqrt ( ), abs ( )
4) String.h:-
String functions. Example: - strcpy ( ), strlen ( )
To include the header file in the program # include statement is used as:-
Constant Declaration:-
If require constant can be declared in the program above the
main ( ) function. It is defined using # define statement. E.g. PI (3.14)
can be declared as a constant to calculate the area of circle as its value
does not change. They are also called as preprocessor directives.
Main ( ) function:-
After linking and declaration statements you can start your
program with 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:-
Finally result will be displayed on screen using the output
statement (function): printf ( ).
Data types:-
While declaring the variable we must have to specify the data
type of the variable. The data type determines the type of value the
variable is going to hold like numeric, character etc. One of the features
of C is that C has variety of data types. There are two types of 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:-
Thinking in our own language and writing it in simple English
language is called as algorithm. There are no special symbols and
commands used in it.
• Algorithm:-
1) Include the required header files in the program.
2) Declare the variables to store two numbers and the addition of the
numbers.
3) Accept two numbers.
4) Perform the addition.
5) Display the result.
• Flowchart:- Start
int a, b,c
c = a+b
End
• Program:-
/* Addition of two numbers */
# 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
Every time to display output we have to press Alt+F5 key. To avoid this
getch () function can be included at the end of the program.
With every c program i.e. c file two more files gets created:
• Main ( ):-
This function is used as a starting point of the program. It tells
the compiler that the programs is started from the point or statement. It
is void function i.e. it does not have any parameter and it does not
return any value. All the executable statements must be given in the
main ( ) function because execution starts with main ( ).
• Printf ( ) :-
Printf ( ) is one of the most versatile function in C. In fact it is
a standard library function used to display the output on the screen.
We can format the output using various formatting options like
'\n','\t', %3d etc.
Syntax:-
Printf (" Format string ", list of variable);
OR
Examples:-
"\n":- It is called new line and it takes the cursor to the next line
• Scanf ( ) :-
Scanf ( ) is used to accept data through keyboard (from user)
Syntax: -
Scan (" format specifier ", & variable name);
Operator'&' is used before the variable to get the address of the
variable. It takes the location number where variable is defined '&'
is not required when we are using '%s' operator for string values.
Example:-
Scan ( "%d %d", &p,&n, name ): We can accept multiple values
with a single scanf ( ) statement.
{
Int p, n;
Float r. si:
Printf (" Enter value of p, p, r ");
Scant (" %d%d%f', &p, &n. &r);
Si= p*n* r/100;
Printf (" simple interest is = %. 2f", si);
}
# 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 :-
Operators are use to perform various operations like addition,
comparison etc. C supports following operators.
• Mathematical Operators :-
'+','-','*','\','%' ( modulus operator) etc.
• Relational Operator :-
• Note :-
• = is used for assignment operator.
• = = is used for comparison of two quantities.
• Logical Operators :-
&& (and) , | | (or) , ! (not)
Hierarchy of Operators :-
The operators are evaluated in order of their priority. The hierarchy
(priority) of commonly used operators is shown in fig
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 :-
Nested if is perfectly all right if we write an entire 'if-else' construct
within another if block or else block. This is called Nesting' of ifs.
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 :-
expression 1 ? expression 2 : expression 3
if expression 1 is true, then the value returned will be expression 2
otherwise the value returned will be expression.
Example :-
# include <stdio.h>
main ( )
{
int x, 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 :-
for (initialization :condition: increment/decrement)
{
Group of statements;
}
Initialization part will be executed only once i.e. at the starting of loop.
Then condition will check. If it is true then statements will be executed
and then increment/decrement part will be executed. Again condition
will be checked and same procedure will performed. All the three parts
must be separated by a ';'.For loop can be used when there is fixed
number of iterations.
START
initialise
False
Test
condition
True STOP
Body of loop
Increment
For Loop
Syntax :-
do
{
group of statements;
loop counter variable;
} while (condition)
The difference is that in while loop condition will be checked first and
then statements will be executed. But in do...while loop statements will
be executed first and condition will be checked at the end of loop as it is
condition is false. Here while statement should end with a ';'.
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 ( ):-
kbhit ( ) function checks whether a key is hit or
not. It returns true if any key is hit from keyboard otherwise returns
false. Defined in conio.h.
• Exit (int) :-
It is used to terminate the program execution. It takes integer
argument as 0 or 1.
Nested loop :-
A loop within a loop is known as 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);
}
}
}
Note that when the value of i equals that of j , the continue statement
takes control to the starting of inner for loop by ignoring rest of the
statements pending for execution in the inner for loop.
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.
For one dimensional array we have to specify only one dimension i.e.
number of elements. For two or multi dimensional array we have to
specify more than one dimension. Two dimensional arrays are also
known as matrix.
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:-
An array can be initialized in different ways. Following are the
different ways for initializing numeric 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
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.
Though str is a character array, its elements are referred by integer value
so i should be of integer type. 'c' operator takes a single character. The
complete string (array) can be printed using '%s' operator. It also be used
with scan ( ) to accept a string. %s considers the whole string at a time
as:
# 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 :-
Data type array name [row size][column size]
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
This mechanism can be used for matrix operations like matrix addition,
matrix, multiplication etc.
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.
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.
The value of static variable remains alive through the whole program.
That is the variable gets initialized only once.
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 gets
incremented by the increment ( ) function i.e.2. Then it will be
decremented by decrement ( ) function i.e. again 1 and finally it gets
decremented by the main ( ) function, so the final value of i is 0.
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:-
The general form of a structure declaration is:-
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 ( );
}
Array of structure :-
In above program to store data for 100 books we have to define different
structure variables from b1 to b100, which is not very convenient.
Similarly printf ( ) and scanf ( ) statements are given three times which
increases the length of program. A better approach would be to use an
array of structures. The structure variable can be declared as array to
store data for multiple books. It is manipulated in the same way as the
normal array is.
# 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 :-
One structure can be defined within another structure. This is known as
nesting of structures. Using this facility complex data types can be
created.
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.
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:-
Library Functions are the commonly required functions grouped
together and stored in a library. They are predefined functions and can
be called anywhere. E.g. printf ( ), scanf ( ), sqrt ( ), strlen ( ) etc.
Following are some Library Functions given category wise
# 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 Prototype:-
It is the declaration statement of the function. It tells the compiler what
type of function it is i.e. return type, parameter type of the function etc.
It should be given above the main ( ) function and it should have a
semicolon. The general form of the prototype statement is :
Return type function name (parameter type):
* 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:-
A function depending on whether arguments are present or not and
whether a value is returned or not, may belong to one of the following
categories.
• Void function:-
When a function has no arguments and it doesn't return anything then is
called as void function. It does not receive any data from the calling
function. Similarly when it does not return a value, the calling function
does not receive any data from the called function. In fact there is no
data transfer between the calling and the called function. The complete
procedure is performed by the function itself.
Void Function
Example 1:-
# include <stdio.h>
void add ( ); > Function
Prototype
main ( )
{
clrscr ( ); > Function Call
add ( );
getch ( );
}
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 ( );
}
Function1 ( ) arguments
Function 2 (b)
{ {
One way data
---------------- ------------------
Function 2 (a) Communication ------------------
----------------- ------------------
} }
Values
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.
We should ensure that the function call has matching arguments. Incase
the actual arguments are amore than the formal arguments (m >n), the
extra actual arguments are discarded on the other hand, if the actual
argument are less than the formal argument the unmatched formal
arguments are initialized to some garbage values. Any mismatch in data
types will give error.
• Parameter Passing:-
We can pass the value of parameter to the function using two methods.
1) Call by value.
2) Call by reference.
• Call by value:-
In this method we have to pass the value to the function by directly
specifying the variable name with the function call. In this method a
copy of the original arguments gets created in the function and value in
the actual variable will remain same.
• Call by reference:-
In this method the value should be passed by passing the address
(reference) of variable. In this method the original value will gets
changed by the function. The variable inside the function should be of
pointer type.
Examples based on first method are discussed here. The second method
will be used with pointer concept further.
# 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);
}
Here a , b are the actual arguments and x , y are the formal arguments.
Two numbers are accepted into a and b and they will be passed to the
function when it is called. The value a will be passed into x and value of
b will be passed to y. Similarly we can pass float or character values to
the function. The name of the actual arguments and formal arguments
can be same as they are considered as local variables.
The result will be printed if a = 10 and b = 20 as
Here the add ( ) function is returning an integer value i.e. the addition of
number passed which gets stored into c in main ( ) function and then it is
printed.
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 :-
To declare a pointer '*' operator is used. The pointer name statement
must precede with '*' operator.
Pointer name can be any valid name.
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.
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'.
Here we have declared a pointer as *p. The address of the variable must
be assigned to the pointer before accessing.
Example:-
p = & i;
6485
6530
3
I 6485
P
Memory map
Pointer to function:-
Arguments can be passed to the function using two methods.
1) Call by value. / / As discussed in Function
concept.
2) Call by reference.
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:-
Arguments can be passed to the function using two
1) Call by value. / / As discussed.
2) Call by reference.
# 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.
"A file is a place on the disk where group of related data is stored".
"C" supports a number of functions that have the ability to perform basic
file operation. They are divided into two categories :
High level files I/O functions.
Low level files I/O functions.
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:-
To open a file fopen ( ) function is used.
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:-
A file must be closed as soon as all operation on it has been completed.
This ensures that all outstanding information associated with the file is
flushed out from the buffers and all links to the file are broken. It takes
the following form.
Syntax:-
fclose (file pointer);
e.g.:-
fclose (fp);
putc ( ) function writes a single character to the file specified by the file
pointer.
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 :-
Data stored in the file : Happy Diwali
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);
i) output streams to which data should be written. There are two output
streams that can be provided.
a) Standard Output stream i.e. stdout that refers to the standard output
device -screen.
b) File stream i.e. filepointer (fp) that refers to the file.
If filepointer is given, data will be written to the file. If stdout is given
data will be written to screen.
ii) format strings like %d %f etc.
iii) Variable list through which data will be provided to the file.
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 ( ) :-
fseek ( ) function moves the file pointer to the specified position in the
file. It takes three arguments :-
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:-
fseek (fp, 31, 0) :- Moves pointer three positions ahead from beginning
of file.
fseek (fp, 31, 1) :- Moves pointer three positions ahead from current
position.
fseek (fp, -21, 2) :- Moves pointer two positions back from current
position.
fseek (fp, -41, 2) :- Moves the pointer four positions back from end of
file.
• 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.
2)We can provide data to the program through command prompt.i.e. the
program can be executed as a command.
Syntax :-
main (int arge, char *argv [ ] )
The name of the arguments can be changed. First argument is the integer
argc which holds the count of the arguments i.e. total no. of arguments
passed. Second argument is an array of pointer to strings which holds
the actual arguments one by one in the element. The strings at the
command line are stored in the memory and their address will be stored
in each element of argv [ ]. These arguments will be used in the
program. The program name will be the first argument which goes in
argv[0]. It is the exe file or command file that is run on command
prompt. Using this we can create commands like dos copy con
command or dos copy command etc.
# 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 ( );
}
Save above program by the name 'create' , compile and execute it ones
to generate its .exe file and give following command at the command
prompt to create a new file which will be stored on the hard disk..
# 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);
# 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++:-
1) The main thing is it is difficult to read the keyboard, invert the vector.
For display of data or a function that checks or correct input is important
but it cannot be check.
2) The data makes up the inventory is probebbaly read from a list into
memory it treated as global variable.
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 :-
2) The text expression, which usually checks the value of loop variable
to see whether the cycle again or exit from the 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 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:-
I am student of COPA
5) $ ps (prace ss status) :-
The ps command makes process status Report the process. Status Report
is as line this.
Report is as line this
The first column process identification number each time kernal assign
a unique p1 the sh is shell oph is processed status or other input device
which we are using & time command displays time which is used for
processing.
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)
5) MV :- (Method Vehicle)
The command is used to change the name of file the first name is
ole name & second name is new name after the command prompt.
UNIX EDITOR:-
The VI editor can be access in three ways this are shown below.
i) Vi - it edits & empty editing buffer.
ii) Viname - it edits & file with specified file name
iii) Vi+3 name: - it opens file with a specified name and goes third line
idefine
iv) vi+/bye name: - it searches for the first occurrence of bye in the file
commands used with other users.
1) Write:-
The easy way to communicate with other user who are logged in
the syntax of write command is as following type.
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:-
i) System security. The standard log in procedure secured user data. The
next level of security is the permission to access the files are read, write,
execute is unsigned by the owner of the file this is level of security
allows the users to in script data files on this so that the data remains
secure.
Database Environment:-
Data:-
Information:-
1) FoxPro
2) Oracle
3) Ms-Access
FOXPRO
INTROEDUCTION TO FOXPRO:-
PROGRAM:-
SOFTWARE:-
The collection of program which are used between the user and
the computer is called as 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:-
Here you can use alphabets and also numbers. Maximum allow
able range is 255 characters.
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:-
5) The editor of FoxPro is more powerful which provide cut, paste and
copy etc.
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:-
It is a menu driven mode from which you can select the options.
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
We can also we the list command with condition. In this case for
clause is used.
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:-
This command is used to exit from the FoxPro & returns to the
operating system.
Syntax: - QUIT
CLEAR:-
This command is used to close the entire file, which are opened.
We can close any type of FoxPro file using this command.
APPEND:-
Syntax: - APPENED.
APPENED BALNK:-
This command is used to add one blank record at the ened of the
currently opened file.
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:-
This Command is used to delete all the record permanently from DBF.
Syntax: - ZAP
The structure of the fill will remain same only the record will deleted.
This command is used to undelete the all logically deleted record at one
time.
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.
The basic way of using the LOCATE dialogue box is by checking the
FOR check box & then in the expression builder, enter the logical
expectation you will be using as the criterion for the search LOCATE
FOR will begin it's search with the first rec. & read it sequentially until
it finds the matching record. It moves the record pointer to that 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
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:-
Simple indexing is used for indexing on the single field. But for
multiple indexes in compound indexing is used. You can create multiple
index files (.IDX) using simple indexing. Which are crated on different
fields?
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.
By default is it OFF. When it is on you will see clock on right top corner
of screen
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
Functions means the set of program which is designed for some specific
purpose
NUMERIC FUNCTIONS. :-
1) Abs ( ):-
2) Int ( ):-
3) Log ( ):-
4) Max ( ):-
5) Min ( ) :-
6) Sqrt ( ) :-
7) Mod ( ):-
DATABASE FUNCTIONS:-
8) Round ( ):-
O/P: 65.8
? round (68.567.2)
O/P :68.57
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 ( ):-
This function gives specified no. of characters form the right side
of given string.
4) LTRIM ( ):-
5) RTRIM ( ):-
6) REPLACE ( ):-
7) SUBSTR ( ):-
8) SPACE ( ):-