如果您无法下载资料,请参考说明:
1、部分资料下载需要金币,请确保您的账户上有足够的金币
2、已购买过的文档,再次下载不重复扣费
3、资料包下载后请先用软件解压,在使用对应软件打开
/*Filename:BLAKJACK.CThisprogramplaysagameofBlackjackwithyou.Thecomputeristhedealerandyouarethevictim-er,Imeanplayer.Thedealergetsacardthatyoucansee.Thedealerthenasksifyouwantanothercardbyasking“Hit”or“Stand.”Ifyouchoosetohit,thedealergivesyouanothercard.Ifyouchoosetostand,thedealerdrawsorstands,andthegameisplayedoutaccordingtothecardsyouandthedealerhave.AswithrealBlackjack,thedealerstandson17.Thewinnerisannouncedonlyafterboththeplayer’sandthedealer’shandsarefinished.*//******************************************************ANSICstandardheaderfilesappearnext*/#include<stdio.h>#include<time.h>#include<ctype.h>#include<stdlib.h>/******************************************************Definedconstantsappearnext*/#defineBELL‘\a’#defineDEALER0#definePLAYER1/*Mustkeeptwosetsoftotalsfordealerandforplayer.ThefirstsetcountsAcesas1andthesecondcountsAcesas11.Unlike“realworld”Blackjack,thisprogramdoesn’tallowsomeAcestobe1whileothersAcesare11inthesamehand.*/#defineACELOW0#defineACEHIGH1/*Onlyoneglobalvariableisusedinthisentireprogram.Thevariableholds0,whichmeansfalseinitially.OncetheuserentershisorhernameininitCardsScreen(),thisvariableissetto1(fortrue),sothenameisneveraskedforagaintherestoftheprogram.*//******************************************************Thisprogram’sspecificprototypes*/voiddispTitle(void);voidinitCardsScreen(intcards[52],intplayerPoints[2],intdealerPoints[2],inttotal[2],int*numCards);intdealCard(int*numCards,intcards[52]);voiddispCard(intcardDrawn,intpoints[2]);voidtotalIt(intpoints[2],inttotal[2],intwho);voiddealerGetsCard(int*numCards,intcards[52],intdealerPoints[2]);chargetans(charmesg[]);voidfindWinner(inttotal[2]);/******************************************************C’sprogramexecutionalwaysbeginsatmain()here*/Main(){intnumCards;/*Equals52atbeginningofeachgame*/intcards[52],playerPoints[2],dealerPoints[2],total[2];charans;/*Foruser’sHit/StandorYes/Noresponse*/do{initCardsScreen(cards,playerPoints,dealerPoints