COMP 217 Lab 5

Points: 30 Due Date: Wednesday June 2, 2004

This will involve decoding a message. You will be given the encoded message. You have to try all possible keys to decode the message. For each key you try, you will print the key being tried and the decoded message. Only one of the keys will work, but you must try all of them.

The output will be written to a file rather than the screen. You can read the original message from the keyboard (not recommended), from a file or put it in the code as a string constant. Also, all character array string handling must be done using pointers, not array notation. That also means no using *(p+i) kind of substitution for p[i].

Everybody gets there own message, each encoded with a different key. Well, since there are 27 of you, some keys are reused. But the text isn't. Each message is a line from a Shakespeare sonnet. Here is a table of names and encoded strings.

NameMessage
Anderson,Adamxifo jo ejthsbdf xjui gpsuvof boe nfot fzft
Armknecht,Randyk cnn cnqpg dgyggr oa qwvecuv uvcvg
Atkinson,Robertdqg wurxeoh ghdi khdyhq zlwk pb errwohvv fulhv
Barker,Daviderh psso ytsr qcwipj erh gyvwi qc jexi
Delio,Michaelbnxmnsl rj qnpj yt tsj rtwj wnhm ns mtuj
Erguiza,Kennethlkgzaxkj roqk nos roqk nos cozn lxoktjy vuyykyykj
Eyer,Coreyklzpypun aopz thuz hya huk aoha thuz zjvwl
Garcia,Cesareqbp epib q uwab mvrwg kwvbmvbml tmiab
Giseburt,Jenniferhnc rw cqnbn cqxdpqcb vhbnuo juvxbc mnbyrbrwp
Goodman,Atifrkzvi s drsxu yx droo kxn drox wi cdkdo
Graff,Scottwtvp ez esp wlcv le mcplv zq olj lctdtyr
Hart,Tannerrday egxxqz qmdft euzse tkyze mf tqmhqze smfq
Huntington,Thomassbe gul fjrrg ybir erzrzorerq fhpu jrnygu oevatf
Kowalik,Timhvoh hvsb w gqcfb hc qvobus am ghohs kwhv ywbug
Kumar,Maneeshati iwdht lwd pgt xc upkdjg lxiw iwtxg hipgh
Layman,Williamev fkrbys xedekh qdt fhekt jyjbui reqij
Leon,Santiagonyzcjk z nyfd wfiklev fw jlty kizldgy srij
Malik, Alimfdggcwv xgj bgq af lzsl a zgfgmj egkl
Navarrete,Eduardozkxtm ikbgvxl ytohnkbmxl maxbk ytbk extoxl likxtw
Oldfather,Jaysonvon um nby gulcaifx un nby mohm ysy
Oloffson,Charlesviy di oczhnzgqzn oczdm kmdyz gdzn wpmdzy
Robbins,Aaronbkn wp w bnksj pdau ej pdaen chknu zea
Salinas,Cristobalqeb mxfkcri txooflo cxjlrpba clo cfdeq
Socorro,Joeyydrcp y rfmsqylb tgarmpgcq mlac dmgjcb
Taglia,Christopherhr eqnl sgd annj ne gnmntq qzydc pthsd
Wilson,Edwardboe bmm uif sftu gpshpu gps xijdi if upjmfe
Wolf,Brandonvjgp jcrra k vjcv nqxg cpf co dgnqxgf

The input is a string of characters.

The output is a table of keys and strings.

The purpose of this assignment is to practice working with strings, pointers and files.

Here is a sample run. Your output doesn't have to look exactly like this. Note that there is no output to the screen from running the program, it all goes into the file.

--> ./lab5
--> cat lab5out
0       zhofrph edfn pb iulhqgv wr wkh vkrz wkdw qhyhu hqgv
1       ygneqog dcem oa htkgpfu vq vjg ujqy vjcv pgxgt gpfu
2       xfmdpnf cbdl nz gsjfoet up uif tipx uibu ofwfs foet
3       welcome back my friends to the show that never ends
4       vdkbnld azbj lx eqhdmcr sn sgd rgnv sgzs mdudq dmcr
5       ucjamkc zyai kw dpgclbq rm rfc qfmu rfyr lctcp clbq
6       tbizljb yxzh jv cofbkap ql qeb pelt qexq kbsbo bkap
7       sahykia xwyg iu bneajzo pk pda odks pdwp jaran ajzo
8       rzgxjhz wvxf ht amdziyn oj ocz ncjr ocvo izqzm ziyn
9       qyfwigy vuwe gs zlcyhxm ni nby mbiq nbun hypyl yhxm
10      pxevhfx utvd fr ykbxgwl mh max lahp matm gxoxk xgwl
11      owdugew tsuc eq xjawfvk lg lzw kzgo lzsl fwnwj wfvk
12      nvctfdv srtb dp wizveuj kf kyv jyfn kyrk evmvi veuj
13      mubsecu rqsa co vhyudti je jxu ixem jxqj duluh udti
14      ltardbt qprz bn ugxtcsh id iwt hwdl iwpi ctktg tcsh
15      kszqcas poqy am tfwsbrg hc hvs gvck hvoh bsjsf sbrg
16      jrypbzr onpx zl sevraqf gb gur fubj gung arire raqf
17      iqxoayq nmow yk rduqzpe fa ftq etai ftmf zqhqd qzpe
18      hpwnzxp mlnv xj qctpyod ez esp dszh esle ypgpc pyod
19      govmywo lkmu wi pbsoxnc dy dro cryg drkd xofob oxnc
20      fnulxvn kjlt vh oarnwmb cx cqn bqxf cqjc wnena nwmb
21      emtkwum jiks ug nzqmvla bw bpm apwe bpib vmdmz mvla
22      dlsjvtl ihjr tf myplukz av aol zovd aoha ulcly lukz
23      ckriusk hgiq se lxoktjy zu znk ynuc zngz tkbkx ktjy
24      bjqhtrj gfhp rd kwnjsix yt ymj xmtb ymfy sjajw jsix
25      aipgsqi fego qc jvmirhw xs xli wlsa xlex riziv irhw
26      zhofrph edfn pb iulhqgv wr wkh vkrz wkdw qhyhu hqgv

Deliverables:

I only need the .c file. You don't need to send me the executable file or the output.

Notes


ASK if you have any questions. Or if you get error messages that you don't understand. If you are getting stuck, call or email me.