Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

Lab3CRefresherModule(FileHandling)

1.WAPwhichdisplaysitssourcecodeontheoutputscreen.

2.WriteaprograminCwhichtakesatextfile'snameascommandline
argumentandreadthefirst
word,displaysitandskipnextnwordswherenisthelengthoflast
wordyoujustdisplayed.Repeat
untilyoureachendoffile.

3.Writeaprogramtoreadafileanddisplayitscontentsalongwith
thelinenumberbeforeeachline
andtotalnoofcharacteraftereachline.
SampleOutput1:
<onconsole>
1welcometoweek4ofC
module.30
2thisisyourassignment.24
......................................
.......................................
<end>

4.1WAPthatacceptsafileasinputandprintsonlythoselinesof
thefilewhichcontainsonlyone
vowel.Makenecessaryassumptionswherevernecessary.

4.2Toencrypt/decryptamessageusingashiftciphereachcharacter
ofthemessageisshiftedbya
predeterminedvalue(calledkeyoroffset).Encryptionanddecryption
aredefinedasinverseoperation
ofeachother,i.e.,decryptionofaencryptedmessageresultsthe
originalmessage.
Writeaprogramtoencrypt/decryptafileusingshiftcipher.The
programshouldaccepttwoarguments
'e'or'd'(forencryptionanddecryptioncorrespondingly)anda
integerkeyvalue(shiftvalue).

5.WriteaprograminC
toaccept3commandlineargument,twooperands(integers)andone
arithmeticoperator.Performtheoperationontwooperandsandstore
theresultinresult.txttextfile.
Asktheuserifhewantstocontinue.Ifyesthenagaininputthree
symbols(twointegersandone
arithmeticoperator)andappendtheoutputinresult.txtfile.

You might also like