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

COP3223Assignment#9

ProgramA:ListReverser(listreverse.c):
Oneofthegradershasgottenlazy,andinsteadofgradingassignments,hehasdecidedto
justassigngradesrandomly(don'tworry,thisisn'tatruestory).Hehasalistofstudent
namessortedbythegradetheyweregivenonthelastassignment.Inordertomakehis
lazinesslessnoticeable,hehasdecidedtoreversethelisttoassigngradesthistime.Please
helphim.

Thefirstinputtotheconsolewillbeapositiveinteger,
N
,thenumberofstudentsonthelist.
Followingthiswillbe
N
lineseachcontainingastudent'sfullnameandID.Eachstudent's
namewillconsistof,spaceseparated,alastandfirstname(eachlessthan50characters),
eachwithnospaceswithin.IDswillbealphanumericlessthan20characterswithnospaces.

Oncethelistofnamesisinput,outputthelistinreverse,inthesameformatasitwasinput.

Youmusthaveandusethefollowingstructinyourprogram:
structStudent{

charfirst[50]

charlast[50]

charid[20]
}

SampleRun(userinputinboldanditalics):
3
DentArthur12345ABC
PrefectFord54321CBA
McMillanTriciaAB9876

McMillanTriciaAB9876
PrefectFord54321CBA
DentArthur12345ABC

ProgramB:Bingo(bingo.c):
Youandsomeofyourfriendshavestartedplayingbingo.Eachofyourfriendshasonebingo
card.Forsimplicity,we'llassumethateachbingocardjustconsistsofasinglerow,soa
playerwinsbyhavingeverynumberontheircard(theentirerow)called(notnecessarilyin
order).Butyoudon'tbelieveyourfriendsareplayingcorrectly.Soyouhavedecidedto
implementaprogramthatwillautomatethegameforeveryoneplaying.

Thefirstlineofinputfromstandardinputwillbeaninteger,
N
,thenumberofplayersthis
round.Thefollowing
N
lineswilleachcontainafirstname(astringlessthan50characters
withnospaces)and5distinctpositiveintegers,thenumbersonthatplayer'scard.

Followingthis,aseriesofnumberswillbeinput.Thesenumbersarethenumbersbeing
"called".Whenanumberiscalled,eachplayermarksitontheircard.Assoonasaplayerhas
markedallnumbersontheircard,theyshouldcall"bingo!"(yourprogramshouldoutputthe
name(s)ofthepeoplewhohavebingoatthatpoint)andtheprogramshouldend(sincethe
roundnowends).Itisguaranteedthattherewillalwaysbeenoughqueriesenteredtoreach
thisendstateinsomeway.Note:theprogramshouldfinishwhenatleastoneplayerhas
won,regardlessofanyotherattemptedinput.

Youmusthaveandusethefollowingstructinyourprogram:
structPlayer{

charname[50]

intboard[5]

intboard_size
}

Youmusthaveandusethefollowingfunctioninyourprogram:
//Removesthegivennumberfromtheplayer'sboardifitexistsin
//thatboard,orelsedoesnothing.Adjuststheboard'scontentsand
//sizetoreflectthisremoval.
voidremove_number(Player*player,intnumber)

SampleRun(Userinputinboldanditalics):
3
John12345
Tyler12346
Evan12456
642351
Johnwins!
Tylerwins!
Evanwins!

SampleRun(Userinputinboldanditalics):
3
John12345
Tyler12346
Evan12456
43251
Johnwins!

SampleRun(Userinputinboldanditalics):
3
John12345
Tyler12346
Evan12456
123456
Johnwins!

ProgramC:PasswordRecovery(passrecover.c):
Ohno!You'veforgottenaveryimportantpassword!Youreallyneedtorecoveritoryou're
goingtobeinbigtrouble.Youdorememberalistofallpossiblepasswordsyoumayhave
used,butyoucan'tjustguessastowhatitis,youneedtonarrowitdownmoreaccurately.

Luckily,yousharedthispasswordwithallofyourfriends.Unluckily,yourfriendsalsohave
badmemories(andreally,whywouldyouwantthemrememberingyourpassword,anyway?).
Eachofyourfriendswasabletogiveyouahintastowhatyourpasswordwas.Butsomeof
themmaybewrong.Hintswillbestrings(lessthan50characterseach)consistingof
alphanumericcharactersand*s.Any*meansthatthepersondidnotrememberwhichletter
wasinthatposition.Anyalphanumericcharactermeansthepartofthepasswordthatthat
friendremembershadthatcharacterinthatlocation(casesensitive).Inorderforahinttobe
consideredmatchingapasswordpossibility,theymustbothbethesamelengthandeach
non*charactermustmatchinthesamelocationinthehintandpassword.Nopassword
possibilitiesgivenwillcontainany*s.

Youwillbegiventostandardinputapositiveinteger,
N
,followedby
N
uniquepossible
passwords(eachalphanumericwithoutspaceslessthan50characters).Followingthiswillbe
apositiveinteger,
M
,followedby
M
passwordhints.Youshouldoutputthepassword
possibilitywiththehighestnumberofhintsmatchingit.Iftherearemultiplepossible
passwordswiththesamenumberofhintmatches,outputtheonethatcomes
lexicographicallyfirst(rememberstrcmp).

Hint:tocheckahintagainstapossibility,firstcheckthattheirlengthsareequal,thenloop
characterbycharactertocompareeachrespectiveposition(ifthehintisnon*),makingsure
allofthosematch.


Youmusthaveandusethefollowingstructinyourprogram:
structOption{

charpassword[50]

intmatches
}

Youmusthaveandusethefollowingfunctioninyourprogram:
//Checkstoseeifthegivenpasswordmatchesthegivenpattern.
//Returnsfalse(0)ifitdoesnot,ortrue(1)ifitdoes.
intis_match(charpassword[],charpattern[])

SampleRun(Userinputinboldanditalics):
3
password
secret11
qwertyui
4
*******1
s*******
*e******
*******q
secret11

SampleRun(Userinputinboldanditalics):
4
abcdefg
abcdeff
abcdefa
abcdefb
3
a**d***
******a
******b
abcdefa

Deliverables:
Pleasesubmitthreeseparate.cfilesforyoursolutionstotheseproblemsviaWebCoursesby
thedesignatedduedate:

ProgramA:
listreverse.c
ProgramB:
bingo.c
ProgramC:
passrecover.c

You might also like