i year lab manual r 2004
TRANSCRIPT
-
8/13/2019 I year lab manual R 2004
1/68
-
8/13/2019 I year lab manual R 2004
2/68
EX: NO: 1 ADVERTISEMENT CREATION
AIM:
To create an advertisement in ms-word document.
PROCEDURE:
1. Open a new document using File-->New option and type text.
2. Place the dierent si!ed "oxes in the document rom the drawing tool"ar.
#. Type the text in the "oxes.
$. Fill the "ox with "lac% color using ill color option rom the drawing tool"ar.
&. Place the appropriate logo rom the 'nsert-->Picture-->rom ile option.
(. )hoose the appropriate word art gallery to place the text in "oxes.
*. )hoose the +ullets or the text rom the ormatting tool"ar.
,. se all these options to create an advertisement.
2
-
8/13/2019 I year lab manual R 2004
3/68
-
8/13/2019 I year lab manual R 2004
4/68
EX: NO: 2 MAIL MERGE CREATION IN MS WORD
AIM:
To create a mail merge in ms-word document.
PROCEDURE:
1. 0elect 0tart--> 8icrosot word.
2. From a menu "ar select Tools-->etters and 8ailing-->8ail 8erge. Then the mail merge
window options are displayed.
#. )reate a letter in the word document.
$. 0elect the next option rom the mail merge window.
&. To select a new list option rom the select recipient9 and the data:s in the respective
window9 ater that the create option is displayed and clic% that option.
(. The new address list dialog ield "ox will "e displayed. 'n that "ox using the customi!e
option to short out the entry ield and clic% o%.
*. Then create the add ield records rom the mail merge ield option-->add ield-->choose
the re;uired ield-->'nsert and close it.
,. Now the mail merge documents are displayed.
$
-
8/13/2019 I year lab manual R 2004
5/68
OUTPUT:
From9
BALAJI
1292N7
sector 9 %.%.nagar
To9
7ear Friends9=i how are you. ' am ine here. =ow is your lie going .we are enoying a lot here .'
have oined the ?/1 =' /)= /N@@ )O11/@/. ' saw your name in thedaily maga!ine and ' wish you or all the ollowing competition.
3ours lovingly
BALAJI
&
-
8/13/2019 I year lab manual R 2004
6/68
From
BALAJI
1292N7sector 9
%.%.nagar
To9
AT=')A0T=38 )O8PT/0
NO #
)=//N'
7ear Friends9
=i how are you. ' am ine here. =ow is your lie going .we are enoying a lot here .'
have oined the ?/1 =' /)= /N@@ )O11/@/. ' saw your name in thedaily maga!ine and ' wish you or all the ollowing competition.
3ours lovingly9
BALAJI
(
-
8/13/2019 I year lab manual R 2004
7/68
From9
BALAJI
1292N7sector 9
%.%.nagar
To9
A8'NFO030
NO *
)=/NN'
7ear Friends9
=i how are you. ' am ine here. =ow is your lie going .we are enoying a lot here .'
have oined the ?/1 =' /)= /N@@ )O11/@/. ' saw your name in thedaily maga!ine and ' wish you or all the ollowing competition.
3ours lovingly9
BALAJI
RESULT:
Thus the mails were merged in ms-word.
*
-
8/13/2019 I year lab manual R 2004
8/68
EX: NO: 3 TO CREATE A STUDENT DETAILS
,
-
8/13/2019 I year lab manual R 2004
9/68
AIM:
To create a student details in 80 /xcel with the ollowing details 0tudent Name9 egister
No.9 8ar%s9 Total verage and )lass o"tained.
PROCEDURE:
1. /nter the students name9 no.9 and mar%s in the spread sheet.
2. Place the cursor in /29type B08C+2 D72E
#. Place the cursor in F29type B?/@/C+2D7#E
$. )lic% on @29type B'FCOC+2B&5E9G0/)ON7
)00G9GT='7 )00GEEEE
&. )opy the ormula to the remaining students.
(. Finally the wor%sheet is shown.
OUTPUT:
EX:NO:3 CREATION OF STUDENT DETAILS USING FORMULA EDITOR IN MS EXCEL
NAME S1 S2 S3 TOTAL AVG. CLASS
AJAY 60 50 40 150 50 SECOND CLASS
NAVIN 65 45 90 200 66.66 FIRST CLASS
DEE!A" 9# 6 #4 25# #6 DISTINCTION
AS$IS$ 60 9# 45 203 6.66 FIRST CLASS
SA%ARIS$ # 56 40 14 5# SECOND CLASS
RESULT:
Thus the student details were created in spread sheet.
EX: NO: 4 TO CREATE A C$ART
H
-
8/13/2019 I year lab manual R 2004
10/68
AIM:
To create a chart using student details in 80 /xcel.
PROCEDURE:
1. 0elect the name and mar%s column.
2. )lic% on the chart wi!ard on the ormatting tool"ar.
#. 't shows the chart wi!ard step 1 o $ chart type dialog "ox choose the chart type and clic%
on next.
$. 't shows the chart wi!ard step 2 o $ chart source data dialog "ox9 choose source and
clic% on next.
&. 't shows the chart wi!ard step # o $ chart option dialog "ox. )hoose the chart title 4-axisand 3-axis ta"les and clic% on next.
(. 't shows the chart wi!ard step # o $ chart location dialog "ox. )hoose the chart location
and clic% on next.
*. Then clic% on inish. The chart is displayed on the monitor.
15
-
8/13/2019 I year lab manual R 2004
11/68
OUTPUT:
EX:NO:4 C$ART CREATION IN MS EXCEL
NAME S1 S2 S3 TOTAL AVG. CLASS
AJAY 60 50 40 150 50 SECOND CLASSNAVIN 65 45 90 200 66.66 FIRST CLASS
DEE!A" 9# 6 #4 25# #6 DISTINCTION
AS$IS$ 60 9# 45 203 6.66 FIRST CLASS
SA%ARIS$ # 56 40 14 5# SECOND CLASS
RESULT:
Thus the chart was created using student details in spread sheet.
11
-
8/13/2019 I year lab manual R 2004
12/68
EX: NO: 5 TO CREATE A DE!ARTMENT DETAILS
12
-
8/13/2019 I year lab manual R 2004
13/68
AIM:
To create a department details in 80 Power point.
PROCEDURE:
1. Open a "lan% presentation.
2. )hoose word art option rom the picture in 'nsert menu selection or clic% on word art
"utton rom the drawing tool "ar. word art gallery dialog "ox appears.
#. From the word art gallery choose the appropriate style then clic% o%. n edit word art text
dialog "ox appears9 type your text here9 and then clic% o%.
$. )hoose clip art option rom the picture in 'nsert menu selection or clic% on clip art "utton
rom the drawing tool "ar.&. 'nsert clip art dialog "ox appearsI rom there choose re;uired clip art then clic% o%.
(. Follow the a"ove steps to complete all the slides.
1#
-
8/13/2019 I year lab manual R 2004
14/68
OUTPUT:
EX:NO:5 DE!ARTMENT DETAIL SLIDE CREATION IN MS
!OWER !OINT
VEL HIGH TECH
ENGG. COLLEGE
DEPARTMENT DETAILS1ST YEAR 2006 - 2010
1$
-
8/13/2019 I year lab manual R 2004
15/68
DEPARTMENTS
AVAILABLE
ELECTONICS &
COMMUNICATION ENGG.
(ECE)
COMPUTER SCIENCE
ENGG. (CSE)
INFORMATION
TECHNOLOGY (I T)
BIO TECHNOLOGY
CIVIL ENGG
RESULT:
Thus the department details were created using 80 power point.
1&
-
8/13/2019 I year lab manual R 2004
16/68
1(
-
8/13/2019 I year lab manual R 2004
17/68
-
8/13/2019 I year lab manual R 2004
18/68
PROGRAM:
Minclude
Minclude
-
8/13/2019 I year lab manual R 2004
19/68
OUTPUT:
--8/N--
1 77'T'ON
2 0+T)T'ON# 8T'P')T'ON
$ 7'?'0'ON
5 /4'T/nter your choice D 1
/nter two num"ers D 2 &
ddition D*
--8/N--1 77'T'ON
2 0+T)T'ON# 8T'P')T'ON
$ 7'?'0'ON
5 /4'T/nter your choice D 2
/nter two num"ers D H &
0u"traction D$
RESULT:
Thus the arithmetic operations were perormed "y using switch case.
1H
-
8/13/2019 I year lab manual R 2004
20/68
EX: NO: TO !RINT A !ASCAL TRIANGLE
AIM:
To write a ) program to print pascal:s triangle.
ALGORITHM:
1. 0tart the program
2. ead the input noline and initiali!e 1 to i
#. )hec% i
-
8/13/2019 I year lab manual R 2004
21/68
PROGRAM:
MincludeMinclude
void mainCE
int noline9i99tempI
clrscrCEI
printC/nter the num"er o lines to printEIscanC6d9QnolineEI
orCiB1Ii
-
8/13/2019 I year lab manual R 2004
22/68
EX: NO: # TO !RE!ARE AN ELECTRICITY %ILL
AIM:
To write a ) program or electricity "ill preparation.
ALGORITHM:
1. 0tart the program
2. ead 0rl.No9rect.No9+ill month9date
#. )onsumedBpresent-previous
$. )hec% with i condition consumed >B255CaE Total Bconsumed K2.&5 elseC"ETotal
Bconsumed K1.&5
&. Print 0rl.No9rect.No9+ill month9date
(. Print )onsumed9Total
*. 0top the program.
22
-
8/13/2019 I year lab manual R 2004
23/68
PROGRAM:
MincludeMinclude
void mainCE
int present9previous9consumed9srlnoI
char nameS259reptnoS159"illmonthS1&9dateS12I
loat totalI clrscrCEI
printC/nter 0erial Num"er Q eceipt Num"er DEI
scanC6d6s9Qsrlno9reptnoEI
printC/nter +ill 8onth Q 7ate DEI scanC6s6s9"illmonth9dateEI
printCPresent and Previous readings DEI
scanC6d6d9Qpresent9QpreviousEI
consumed B present-previousI iCconsumed >B 255E
totalBconsumedK2.&5I else
totalBconsumedK1.&5I
printCntt//)T')'T3 +'nEI printCtt--------------nEI
printC0) No.6dttteceipt.No. 6sn9srlno9reptnoEI
printC+ill 8onth D 6stt7ate D 6sn9"illmonth9dateEI
printCTotal cost or consumed 6d unit is s D69consumed9totalEI getchCEI
R
OUTPUT:
/nter 0erial Num"er Q eceipt Num"er D12# ) 2#
/nter +ill 8onth Q 7ate D(L255(
Present and Previous readings D$#5 #55
//)T')'T3 +'
--------------
0) No.12# eceipt.No. )+ill 8onth D 2# 7ate D (L255(
Total cost or consumed 1#5 unit is s D1H&.555555
RESULT:
Thus the /lectricity "ill was prepared.
2#
-
8/13/2019 I year lab manual R 2004
24/68
EX: NO: 9 TO FIND T$E VALUE OF SINE AND COSINE SERIES
AIM:
To write a ) program to print sine and cosine series.
ALGORITHM:
SINE SERIES
1. 0tart the program
2. ead x and n
#. )onvert x values into radian using ormula xxK#.1$12L1,5
$. tx
&. sumx
(. 0etup or loop rom '1 until Ci
-
8/13/2019 I year lab manual R 2004
25/68
PROGRAM FOR SINE SERIES:
Minclude
Minclude
Mincludevoid mainCE
loat x9t9sumIint i9nI
clrscrCEI
printC/nter the value o x9nDEI
scanC66d9Qx9QnEIprintC6$.2 6dn9x9nEI
xBxK#.1$12L1,5I
tBxI
sumBxIorCiB1Ii
-
8/13/2019 I year lab manual R 2004
26/68
PROGRAM FOR COSINE SERIES:
Minclude
Minclude
Mincludevoid mainCE
loat x9a9sum9tempIint i9noB259mulI
clrscrCEI
printC/nter the value o xDEI
scanC69QxEIaBxI
xBxK#.1$12L1,5I
tempB1I
sumB1IorCiB1Ii
-
8/13/2019 I year lab manual R 2004
27/68
EX: NO: 10 TO !ERFORM MATRIX MULTI!LICATION
AIM:
To write a ) program to perorm matrix multiplication.
ALGORITHM:
1. 0tart the program
2. ead rows and columns limit or matrices m9n9p9;
#. )hec% p is e;ual to n else goto step 12
$. 0et a loop to get matrix values.
&. ead matrix value aSiS
(. 0et a loop to get + matrix
*. ead matrix value "SiS
,. epeat step H until i
-
8/13/2019 I year lab manual R 2004
28/68
-
8/13/2019 I year lab manual R 2004
29/68
print CThe no. o rows and columns should not "e e;ualEI
getchCEI
R
OUTPUT:
/nter the si!e o the matrixD2 2/nter the si!e o the + matrixD2 2
/nter the elements o matrix.
1 2 # $
/nter the elements o + matrix.12 2 # $
8ultiplication o and+ matrixD
1, 15
$, 22
RESULT:
Thus the matrix multiplication was perormed.
2H
-
8/13/2019 I year lab manual R 2004
30/68
EX: NO: 11 TO !RE!ARE SALES RE!ORT
AIM:
To write a ) program to prepare and print the sales report
ALGORITHM:
1. 0tart the program.
2. ead n
#. 0et a loop to get a num"er o items
$. ead pid9 ;ty9 price
&. total B;tyKprice(. chec% iC;ty
-
8/13/2019 I year lab manual R 2004
31/68
PROGRAM:
Minclude
Minclude
void mainCE
int i9priceS159pidS159;tyS159nI
int totalS159commS15IclrscrCEI
printCn /nter The Num"er o Products DEI
scanC6d9QnEI
printCn /nter The Product '7 9 Uuantity and Price DnEIorCiB1Ii
-
8/13/2019 I year lab manual R 2004
32/68
OUTPUT:
/nter The Num"er o Products D&
/nter The Product '7 9 Uuantity and Price D
1 15 15
2 25 25# #5 #5
$ $5 $5
& &5 &5
Pid Uuantity Price Total )ommission
--------------------------------------------------
1 15 15 155 &
2 25 25 $55 25# #5 #5 H55 $&
$ $5 $5 1(55 ,5& &5 &5 2&55 12&
RESULT:
Thus the sales report was prepared and printed.
#2
-
8/13/2019 I year lab manual R 2004
33/68
EX: NO: 12&'( TO CONCATINATE T$E TWO STRING WIT$OUT USING
STRING FUNCTIONS
AIM:To write a ) program to concatenate the two strings without using string
unctions.
ALGORITHM:
1. 0tart the program
2. ead str19 str2.
#. 0et a loop to move str# to str1.$. 0et a loop to move str# to str2.
&. Print str#.
(. 0top the program.
##
-
8/13/2019 I year lab manual R 2004
34/68
PROGRAM:
Minclude Minclude
void main CE
char str1S159str2S159str#S$5I
int i9I
clrscr CEI
print C/nter the two stringDEIscan C6s6s9str19str2EI
orCiB5Istr1SiWBX5XIiJJE
str#SiBstr1SiI
RorCB5Istr2SWBX5XIJJE
str#SiBstr2SIiJJI
R
str#SiBX5XI
print Cconcatenated string is...... 6sn9str#EIgetchCEI
R
OUTPUT:
/nter the two stringD=PP3
+'T=73
)oncatenated string is...... =PP3+'T=73
RESULT:
Thus the two strings were concatenated "y using ) program.
#$
-
8/13/2019 I year lab manual R 2004
35/68
EX: NO: 12(!
TO COM!ARE TWO STRINGS WIT$OUT USING STRING FUNCTIONS
AIM:To write a ) program to compare two strings without using string unctions.
ALGORITHM:
1. 0tart the program.
2. ead the two string str19 str2.
#. 0et a loop to compare two string
$. )hec% iCstr1SiBstr2SiE
Print the "oth strings are e;ualG else
Print the "oth strings are not e;ualG
&. 0top the program
#&
-
8/13/2019 I year lab manual R 2004
36/68
PROGRAM:
Minclude
Mincludevoid mainCE
char str1S259str2S25Iint iI
clrscrCEI
printCn /nter The First 0tring D EI
scanC6s9str1EIprintCn /nter The 0econd 0tring D EI
scanC6s9str2EI
orCiB1Ii
-
8/13/2019 I year lab manual R 2004
37/68
EX: NO: 12(!
TO FIND T$E LENGT$ OF T$E STRING WIT$OUT USING STRING
FUNCTIONS
AIM:
To write a ) program to compare two strings without using string unctions.
ALGORITHM:
1. 0tart the program.
2. ead the str
#. 0et the or loop to calculate length o the string.
$. Print length o the string using varia"le len.
&. 0top the program.
PROGRAM:
Minclude
Minclude
void mainCE
char strS&5I
int lenIclrscrCEI
printC/nter the string DEI
scanC6SYn9strEI
orClenB5IstrSlenWBX5XIlenJJEIprintCength o main string is 6dn9lenEI
getchCEI
R
OUTPUT:
/nter the stringD )O8PT/ PO@8
ength o main string is 1(
RESULT:
#*
-
8/13/2019 I year lab manual R 2004
38/68
Thus the length o the string was calculated without using string unctions in ).
EX: NO: 12("!
TO CO!Y T$E STRING WIT$OUT USING STRING FUNCTIONS
AIM:
To write a ) program to copy the string without using string unctions.
ALGORITHM:
1. 0tart the program.
2. ead the str1
#. 0et a loop to copy a string1 to string 2.
$. Print the copied string str2G.
&. 0top the program.
PROGRAM:
Minclude
Minclude
void mainCE
int iI
char str1 S&59str2 S&5I
clrscrCEI printCn/nter the irst string DEI
scanC6s9str1EI printCThe irst string is 6s9str1EI
orCiB5Istr1SiWBX5XIiJJE
str2SiBstr1SiI
R
str2SiBX5XI printCn copy the string 1to string 2 without using strcpyCE unctionEI
printCn The copied string is 6s9str2EI
getchCEI
R
OUTPUT:
/nter the irst stringD =7Z/The irst string is =7Z/
copy the string 1to string 2 without using strcpyCE unction
The copied string is =7Z/
RESULT:
#,
-
8/13/2019 I year lab manual R 2004
39/68
Thus the strings were copied without using string unctions in ).
EX: NO: 13 TO ARRANGE NAMES IN AL!$A%ETICAL ORDER
AIM:
To write a ) program to arrange the names in alpha"etical order using string
manipulations.
ALGORITHM:
1. 0tart the program
2. n5
#. ead strings into nameSn until the entered string /N7G
$. 0etup or loop rom i59 until i
-
8/13/2019 I year lab manual R 2004
40/68
PROGRAM:
Minclude
MincludeMinclude
void mainCE
char namesS25S259tempS159cI
int i99%9nB5I
clrscrCEI
printCn /nter Names To 0top Type Aeyword /N7 ........D EIscanC6s9namesSnEI
whileCstrcmpCnamesSn9/N7E>5E
nJJIscanC6s9namesSnEI
RprintCnEI
orCiB5Ii
-
8/13/2019 I year lab manual R 2004
41/68
OUTPUT:
/nter Names To 0top Type Aeyword /N7 ........DNaveen 0a"rish 8anish [aco" /N7
Naveen
0a"rish
8anish
[aco"
Num"er O Names ......$
ter 0orting The Names re ..... [aco"
8anish Naveen
0a"rish
RESULT:
Thus the names were arranged in alpha"etical order using ) program.
$1
-
8/13/2019 I year lab manual R 2004
42/68
EX: NO: 14
TO CALCULATE T$E MEAN) VARIANCE) * STANDARD DEVIATIONUSING FUNCTIONS
AIM:
To write a ) program to calculate the mean9 variance and standard deviation using
unctions.
ALGORITHM:
1. 0tart the program
2. ead the varia"le n.
#. 0et a loop to get list.
$. ead list
&. 0et a loop to print list
(. Print list
*. 7eviationBsdClist9nE
,. ?arianceBvaClist9nE
H. Print variance
15. Print 7eviation.
F#$%&'$ :)(*+,!
1. meanBavgCE
2. Print m9mean
#. 0et a or loop to calculate sum
$. sumBsumJCmean-xSiEKCmean-xSiE
&. devBs;rtCsumLCloatEmE
(. eturn dev
*. 0top the program
F#$%&'$: "-(*+,!
1. 8eanBavgCx9mE
2. 0et a or loop to calculate sum.
#. sumBsumJCmean-xSiEKCmean-xSiE
$. varBsumLCloatEm
$2
-
8/13/2019 I year lab manual R 2004
43/68
&. eturn var
(. 0top the program.
F#$%&'$: -" (-+$!
1. 0et a loop to calculate sum
2. sum BsumJaSi
#. eturn CsumLCloatEnE
$. 0top the program.
PROGRAM:
Minclude
Minclude
Mincludevoid mainCE
int i9nI
loat deviation9variance9listS25I
loat sdCE9vaCEIclrscrCEI
printC0tandard 7eviationnEI
printC/nter the pper imit...EI
scanC6d9QnEIprintC/nter the 6d elementsn9nEI
orCiB5Ii
-
8/13/2019 I year lab manual R 2004
44/68
-
8/13/2019 I year lab manual R 2004
45/68
EX: NO: 15
TO !ERFORM SE+UENTIAL SEARC$ AND %INARY SEARC$ USING
FUNCTIONS
AIM:
To write a ) program to perorm se;uential search and "inary search using unctions.
SE/UENTIAL SEARCH
ALGORITHM:
1. 0tart the program.
2. 1IcB:y:
#. epeat steps # through step 11 until cB:y: or cB:y:
$. ead upper limit n.
&. 0etup or loop i5I until i
-
8/13/2019 I year lab manual R 2004
46/68
BINAR0 SEARCH
ALGORITHM:
1. 0tart the program.
2. 1
#. ead upper limit o array \n:.
$. 0etup or loop rom i1I until i
-
8/13/2019 I year lab manual R 2004
47/68
SE/UENTIAL SEARCH PROGRAM:
Minclude
MincludemainCE
int i99%9no9aS1559B1Ichar c B XyX9chI
clrscrCEI
whileCcBBXyXVVcBBX3XE
printCn /nter the si!e o sortingEI scanC6d9QnoEI
printCn /nter the elements o the arrayEI orCiB5Ii
-
8/13/2019 I year lab manual R 2004
48/68
/nter the element to "e searched&
/lement & is in the position #
' you want to continue yLn
BINAR0 SEARCH PROGRAM:
MincludeMinclude
mainCE
int aS1559i9no9l9h9m9t9B1I
clrscrCEI
printC/nter the si!e o the arraynEIscanC6d9QnoEI
printC/nter the elements in ascending orderEI
orCiB5Ii
-
8/13/2019 I year lab manual R 2004
49/68
/ntered ( is in position #
RESULT:
Thus the se;uential search and "inary search were perormed "y using unctions.
EX: NO: 16 TO !RINT FI%ONACCI SERIES USING FUNCTIONS
AIM:
To write a ) program to print the Fi"onacci series using unctions.
ALGORITHM:
1. 0tart the program
2. ead upper limit n
#. )all unction i"CnE
$. 0top the program
FunctionD i" CnE
1. )hec% i Cn
-
8/13/2019 I year lab manual R 2004
50/68
-
8/13/2019 I year lab manual R 2004
51/68
RESULT:
Thus the Fi"onacci series was printed "y using unctions.
EX: NO: 1TO FACTORIAL OF T$E GIVEN NUM%ER USING FUNCTIONS
AIM:
To write a ) program to ind the actorial o the given num"er.
ALGORITHM:
1. 0tart the program
2. ead input value a
#. actorialCxE
$. Print x9
&. 0top the program
FunctionD actorial Cint nE
1. act1
2. )hec% whileCn>1Eelse goto step #
Factact x9n
Nn-1
#. eturnCactE
&1
-
8/13/2019 I year lab manual R 2004
52/68
-
8/13/2019 I year lab manual R 2004
53/68
-
8/13/2019 I year lab manual R 2004
54/68
PROGRAM:
Minclude
Mincludestruct std
int sno9m19m29m#9m$9m&9m(9totI
char nameS159gradeI
loat avgIRsS15I
void mainCE
loat avgIint tot9n9iI
clrscrCEIprintCenter the num"er o students to process.....EI
scanC6d9QnEI
printCenter student num"er9name and ( su"ect mar%s.....nEIorCiB1Ii
-
8/13/2019 I year lab manual R 2004
55/68
printC6dt6st6dt6t6c9sSi.sno9sSi.name9sSi.tot9sSi.avg9sSi.gradeEI
printCnEIgetchCEI
RR
OUTPUT:
enter the num"er o students to process.....2
enter student num"er9 name and ( su"ect mar%s.....
1551 "alu &( *, ,H H5 *, H,
1552 raee *( &* #5 *, HH &(student mar%s list are....
s.no name total average grade
]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]]
1551 "alu $,H ,1.555555 71552 raee #H( ((.555555 F
RESULT:
Thus the student mar% list was prepared and printed "y using structure in ).
&&
-
8/13/2019 I year lab manual R 2004
56/68
EX: NO: 1 TO COUNT T$E NUM%ER OF OCCURRENCES OF T$E
ELEMENT IN AN ARRAY
AIM:
To write a ) program using pointers to access the elements o an array and count
the num"er o occurrences o the given num"er in the array.
ALGORITHM:
1. 0tart the program
2. ead the upper limit varia"le \n:
#. 0et a loop to get a num"er o elements.
$. ead aSi
&. ead varia"le m
(. 0et up or loop to chec% or same num"er present in the array.
*. )hec% i CaSiBmE
nocBnocJ1
,. Print the values m9noc
H. 0top the program
&(
-
8/13/2019 I year lab manual R 2004
57/68
PROGRAM:
Minclude
Minclude
void mainCE
int KaI
int i9n9m9nocB5IclrscrCEI
printCenter upper limit....D EI
scanC6d9QnEI
orCiB1Ii
-
8/13/2019 I year lab manual R 2004
58/68
EX: NO: 2 TO !ERFORM INVENTORY MANAGEMENT USING FILES
AIM:
To write a ) program or inventory management using iles.
ALGORITHM:
1. 0tart the program
2. Open a ile 'nvG in write mode
#. ead the upper limit value \n:
$. 0et a loop to get code9 ;uantity and price.
&. ead codeSi9;tySi9priceSi
(. ?alueSiB;tySiKpriceSi
*. Print a varia"le codeSi9;tySi9priceSi9valueSi in to the ile
,. )lose ile pointer.
H. Open a ile 'nvG in read mode
15. 0et a loop to print code9 ;uantity9 price and value.
11. ead the data rom ile codeSi9;tySi9priceSi and valueSi12. Print codeSi9;tySi9priceSi and valueSi
1#. )lose ile pointer
1$. 0top the program
&,
-
8/13/2019 I year lab manual R 2004
59/68
PROGRAM:
Minclude
Minclude
void mainCE
F'/ KpI
int i99codeS159;tyS159nI
loat priceS159valueS15IpBopenC'N?9wEI
clrscrCEI
printC/nter the upper limit....EI
scanC6d9QnEIprintC/nter the )O7/9UNT'T39P')/n EI
orCiB1Ii
-
8/13/2019 I year lab manual R 2004
60/68
OUTPUT:
enter the upper limit...&
enter )O7/9 UNT'T39 P')/
15 &( 25511 *, #55
12 &( *55
1# (, #55
1$ (* ,55
)O7/ UNT'T3 P')/ ?/
]]]]]]]]]]]]]]]]]]]]]]
*(2$ &( 255.55 11255.5511 *, #55.55 2#$55.55
12 &( *55.55 #H255.551# (, #55.55 25$55.55
1$ (* ,55.55 (55.55
RESULT:
Thus the inventory management was perormed "y using iles in ).
(5
-
8/13/2019 I year lab manual R 2004
61/68
EX: NO: 21 TO CREATE AND DIS!LAY A LIN"ED LIST
AIM:
To write a ) program or creating and displaying a lin%ed list.
ALGORITHM:
1. 0tart the program
2. 7eclare structure lin%ed]list with mem"ers.
#. )all su"]program createCnodeKpE
$. )all su"]program countCnodeKpE
&. )all su"]program printCnodeKpE
(. headBCnodeKEmallocCsi!e oCnodeEE
*. )all su"]program createCheadE
,. )all su"]program printCheadE
H. Print countCheadE
15. 0top the program.
(1
-
8/13/2019 I year lab manual R 2004
62/68
-
8/13/2019 I year lab manual R 2004
63/68
iClist-> nextWBNE
printC6d-->9list-> num"erEI
iClist->next->nextBBNE
printC6d9list->next->num"erEIprintClist-> nextEI
R
returnIR
int count Cnode KlistE
iClist-> nextBBNEreturnC5EI
else
returnC1JcountClist->nextEEI
R
OUTPUT:
'nput a num"er D
Type -HH to stopD25
'nput a num"er D
Type -HH to stopD$5'nput a num"er D
Type -HH to stopD$5
'nput a num"er DType -HH to stopD&5
'nput a num"er D
Type -HH to stopD$5'nput a num"er D
Type -HH to stopD-HH
25-->$5-->$5-->&5-->$5-->-HHNum"er o itemsB&
RESULT:
Thus the lin%ed list was created and displayed using ).
(#
-
8/13/2019 I year lab manual R 2004
64/68
EX: NO: 22
TO MERGE TWO FILES USING COMMAND LINE ARGUMENTS
AIM:
To write a ) program to merge the given two iles using command line arguments.
ALGORITHM:
1. 0tart the program
2. 7eclare character varia"leKargvS
ile ptrKpIKp2Ip#
#. )hec% iCargcWB$E
Print argc9else
$. Print argvS1
&. )hec% while CreadC'WB/OFEE
Put wC'9p1E
)1B)1J1
(. )lose ile pointerCp1E
*. Print Cc19argvS1E,. p1Bopen CargvS19GrGE
H. )hec% while C'BgetwCp1EWB/OFE
15. print i
11. )lose ile pointerCp1E
12. Print argvS2
1#. p2BopenCargvS29GwGE
1$. )hec% whileCread WB/OFE
Put wC9p2E
)2B)2J1
1&. )lose ile pointerCF2E
1(. 0top the program.
($
-
8/13/2019 I year lab manual R 2004
65/68
-
8/13/2019 I year lab manual R 2004
66/68
-
8/13/2019 I year lab manual R 2004
67/68
-
8/13/2019 I year lab manual R 2004
68/68
(,