A pangram is a sentence that uses every letter of the alphabet at least once. The most famous example of a pangram is
The quick brown fox jumps over the lazy dog.
In the questions below, you shall be working with a list of pangrams.
A list of pangrams is given to you in the file pangrams.txt. Each pangram consists only of lower case letters and blank spaces. There are no punctuation marks. The longest pangram in the file is 58 characters long.
The program lab9.c is given to you that reads individual pangrams from the file and displays it. The program uses the fgets function to read individual lines from the file, and uses the feof function to check if the preceding fgets encountered the end of the file. Below is a description of how these two functions are used within the program.
Your task is to extend the main function and store all the pangrams into an array of strings. You can assume that the number of pangrams will not exceed 40.
In your program,
The sample output when printList is invoked for pangrams.txt is as follows:
junk mtv quiz graced by fox whelps quick wafting zephyrs vex bold jim sex charged fop blew my junk tv quiz how quickly daft jumping zebras vex two driven jocks help fax my big quiz vamp fox held quartz duck just by wing five quacking zephyrs jolt my wax bed the five boxing wizards jump quickly jackdaws love my big sphinx of quartz cozy sphinx waves quart jug of bad milk a very bad quack might jinx zippy fowls pack my box with five dozen liquor jugs few quips galvanized the mock jury box blowzy red vixens fight for a quick jump a quick brown fox jumps over the lazy dog joaquin phoenix was gazed by mtv for luck the quick brown fox jumps over the lazy dog heavy boxes perform quick waltzes and jigs a wizards job is to vex chumps quickly in fog woven silk pyjamas exchanged for blue quartz brawny gods just flocked up to quiz and vex him my faxed joke won a pager in the cable tv quiz show the quick onyx goblin jumps over the lazy dwarf amazingly few discotheques provide jukeboxes cozy lummox gives smart squid who asks for job pen pack my box with five dozen jugs of liquid veneer my girl wove six dozen plaid jackets before she quit wolf zombies quickly spot the jinxed grave six big devils from japan quickly forgot how to waltz big july earthquakes confound zany experimental vow foxy parsons quiz and cajole the lovably dim wiki girl six boys guzzled cheap n raw plum vodka quite joyfully jack quietly moved up front and seized the big ball of wax few black taxis drive up major roads on quiet hazy nights crazy fredericka bought many very exquisite opal jewels sixty zippers were quickly picked from the woven jute bag how razorback jumping frogs can level six piqued gymnasts a quick movement of the enemy will jeopardize six gunboats all questions asked by five watch experts amazed the judge painful zombies quickly watch a jinxed graveyard |
The name of your C program file must be called lab9q1.c, files with any other name will not be marked.
Within the main function, invoke the sortList function followed by the printList function. The sample output is given below.
a quick brown fox jumps over the lazy dog a quick movement of the enemy will jeopardize six gunboats a very bad quack might jinx zippy fowls a wizards job is to vex chumps quickly in fog all questions asked by five watch experts amazed the judge amazingly few discotheques provide jukeboxes big july earthquakes confound zany experimental vow blowzy red vixens fight for a quick jump brawny gods just flocked up to quiz and vex him cozy lummox gives smart squid who asks for job pen cozy sphinx waves quart jug of bad milk crazy fredericka bought many very exquisite opal jewels few black taxis drive up major roads on quiet hazy nights few quips galvanized the mock jury box five quacking zephyrs jolt my wax bed foxy parsons quiz and cajole the lovably dim wiki girl heavy boxes perform quick waltzes and jigs how quickly daft jumping zebras vex how razorback jumping frogs can level six piqued gymnasts jack quietly moved up front and seized the big ball of wax jackdaws love my big sphinx of quartz joaquin phoenix was gazed by mtv for luck junk mtv quiz graced by fox whelps my faxed joke won a pager in the cable tv quiz show my girl wove six dozen plaid jackets before she quit pack my box with five dozen jugs of liquid veneer pack my box with five dozen liquor jugs painful zombies quickly watch a jinxed graveyard quick wafting zephyrs vex bold jim sex charged fop blew my junk tv quiz six big devils from japan quickly forgot how to waltz six boys guzzled cheap n raw plum vodka quite joyfully sixty zippers were quickly picked from the woven jute bag the five boxing wizards jump quickly the quick brown fox jumps over the lazy dog the quick onyx goblin jumps over the lazy dwarf two driven jocks help fax my big quiz vamp fox held quartz duck just by wing wolf zombies quickly spot the jinxed grave woven silk pyjamas exchanged for blue quartz |
The name of your C program file must be called lab9q2.c, files with any other name will not be marked.
six boys guzzled cheap n raw plum vodka quite joyfully crazy fredericka bought many very exquisite opal jewels sixty zippers were quickly picked from the woven jute bag big july earthquakes confound zany experimental vow the quick onyx goblin jumps over the lazy dwarf painful zombies quickly watch a jinxed graveyard foxy parsons quiz and cajole the lovably dim wiki girl a very bad quack might jinx zippy fowls five quacking zephyrs jolt my wax bed six big devils from japan quickly forgot how to waltz my faxed joke won a pager in the cable tv quiz show pack my box with five dozen jugs of liquid veneer brawny gods just flocked up to quiz and vex him vamp fox held quartz duck just by wing all questions asked by five watch experts amazed the judge few black taxis drive up major roads on quiet hazy nights a quick movement of the enemy will jeopardize six gunboats jack quietly moved up front and seized the big ball of wax the quick brown fox jumps over the lazy dog cozy lummox gives smart squid who asks for job pen how razorback jumping frogs can level six piqued gymnasts a wizards job is to vex chumps quickly in fog amazingly few discotheques provide jukeboxes woven silk pyjamas exchanged for blue quartz cozy sphinx waves quart jug of bad milk a quick brown fox jumps over the lazy dog blowzy red vixens fight for a quick jump joaquin phoenix was gazed by mtv for luck pack my box with five dozen liquor jugs few quips galvanized the mock jury box the five boxing wizards jump quickly how quickly daft jumping zebras vex sex charged fop blew my junk tv quiz junk mtv quiz graced by fox whelps my girl wove six dozen plaid jackets before she quit wolf zombies quickly spot the jinxed grave heavy boxes perform quick waltzes and jigs jackdaws love my big sphinx of quartz two driven jocks help fax my big quiz quick wafting zephyrs vex bold jim |
You are free to implement the program in anyway you wish. Principles of modularity should still be obeyed though. The name of your C program file must be called lab9q3.c, files with any other name will not be marked.
In question 2, you would have used the string functions available from the string library. Being proficient programmers now, your task is to re-implement the string functions yourselves. Write equivalent mystrlen, mystrcmp and mystrcpy functions to replace the string functions you have used.
Use the following function prototypes for your programmer defined functions and implement the functions according to the descriptions provided.
In your program, you should not use any of the string library functions other than the ones you defined. The output should be the same as that of question 2 above.
The name of your C program file must be called lab9q4.c, files with any other name will not be marked.
$ man -s3c string
A total of 30 different hosts have accessed this document in the last 441 days; your host, nsrp-source.comp.nus.edu.sg, has accessed it 10 times.
If you're interested, complete statistics for this document are also available, including breakdowns by top-level domain, host name, and date.