您好,欢迎访问三七文档
#includestdio.h#includestdlib.h#includeconio.h#includetime.h#includewindows.hintBookies_score=1000,/*ׯ¼Ò½ð±Ò*/Rlayer_score=1000;//Íæ¼Ò½ð±ÒintBookiesscore=0,/*ׯ¼Òµ±Ç°µãÊý*/Rlayerscore=0;//Íæ¼Òµ±Ç°µãÊýintRandom,/*Íæ¼ÒËæ»úÊý*/Randoms;//ׯ¼ÒËæ»úÊýintBets_P;//Íæ¼ÒÏÂ×¢intCard;//ÊÇ·ñ·¢ÅÆinti=1;ints=1;intmain(void){Star_interface();//¿ªÊ¼½çÃægetch();system(CLS);//---------------------------------ÒÔÏÂΪ²úÉúÍæ¼ÒËæ»úÊý·¢ÅÆ´úÂëJudge_WorL();//Êä»òÕßÓ®º¯Êý}//------------ÒÔÏ¿ªÊ¼½çÃæintStar_interface(){inti;system(color9B);printf(\t\t\tCÓïÑÔÓÎÏ·:¶þʮһµã\n);printf(\n\n\n\n\n\n\n);printf(¡þ¡þ¡þ¡þ¡þ¡þ¡þ¡þ);printf(\n¡þ\n¡þ¡þ¡þ¡þ¡þ¡þ¡þ¡þ¡þ¡þ¡þ¡þ¡þ¡þ\n¡þ\n¡þ\n);printf(¡þ¡þ¡þ¡þ¡þ¡þ¡þ¡þ\n);printf(\n\n);printf(\t\t\t¢Ù£º²é¿´¹æÔò¢Ú£º¿ªÊ¼ÓÎÏ·\n\n);printf(\t\t\tÖÆ×÷ÈË:С¶þ\n\n);printf(\t\t\t°æ±¾ºÅ£º1.0\n\t\t\t);scanf(%d,&i);switch(i){case1:system(CLS);printf(\t\t\t¶þʮһµãÓÎÏ·¹æÔò\n\n\n\t½éÉÜ£ºÊÖÖÐËùÓеÄÅƵãÊýÖ®ºÍ²»³¬¹ý21µã£¬Ë¸ü½Ó½ü21µã£¬¾ÍÓ®µÃÓÎÏ·¡£\n\n);printf(\t\t\t¢Ù£º2µ½10µÄÅƵĵãÊý¾ÍÊÇÆäÅÆÃæµÄÊý×Ö.\n\n\t\t\t¢Ú£ºJ¡¢Q¡¢KµÄµãÊýÊÇ10·Ö.\n\n\t\t\t¢Û£ºAÓÐÁ½ÖÖËã·¨,1»òÕß11,Èç¹ûAËãΪ11ʱ×ܺÍ\n\n\t\t\t´óÓÚ21,ÔòAËãΪ1.\n\n\t\t\t);printf(¢Ü×Ô¼ºÅжϣ¬Ö»Òª²»³¬¹ý21£¬¶¼¿ÉÒÔÔÙÃþÒ»ÕÅ¡£\n\n\t\t\t);printf(¢ÝÍæ¼ÒµãÊý³¬¹ý21µã(±¬ÅÆ),ÔòΪÊä.µãÊýÏàµÈʱ,ׯ¼ÒÓ®.\n\n\t\t\tµãÊý´óÔò´ó.\n);getch();break;case2:break;//default:}printf(\t\t\t\t°´ÈÎÒâ¼ü¿ªÊ¼ÓÎÏ·);//---------------------------------ÒÔÉÏΪ¿ªÊ¼½çÃæ//---------------------------------}intGame_interface(){printf(\t\tׯ¼Ò½ð±Ò:%dÍæ¼Ò½ð±Ò:%d\n,Bookies_score,Rlayer_score);printf(\t\t--------------------------------\n);}intJudge_C(){for(i;i3;i++){srand(time(0));Random=rand()%(14-1+1)+1;//È·¶¨Ëæ»úÊý·¶Î§Îª1-14.while(Random==11){srand(time(0));Random=rand()%(14-1+1)+1;}if(Random==1){NUM_A();if(Rlayerscore+1121){Rlayerscore+=1;}else{Rlayerscore+=11;}}if(Random==2){NUM_2();Rlayerscore+=2;}if(Random==3){NUM_3();Rlayerscore+=3;}if(Random==4){NUM_4();Rlayerscore+=4;}if(Random==5){NUM_5();Rlayerscore+=5;}if(Random==6){NUM_6();Rlayerscore+=6;}if(Random==7){NUM_7();Rlayerscore+=7;}if(Random==8){NUM_8();Rlayerscore+=8;}if(Random==9){NUM_9();Rlayerscore+=9;}if(Random==10){NUM_10();Rlayerscore+=10;}if(Random==12){NUM_J();Rlayerscore+=10;}if(Random==13){NUM_Q();Rlayerscore+=10;}if(Random==14){NUM_K();Rlayerscore+=10;}//------------------------------------------ÒÔÏÂΪׯ¼ÒÅжÏif(s==1){Randoms=rand()%(14-1+1)+1;while(Randoms==11){srand(time(0));Randoms=rand()%(14-1+1)+1;}if(Randoms10){Randoms=10;}if(Randoms==1){if(Bookiesscore+1121){Randoms=1;}else{Randoms=11;}}Bookiesscore+=Randoms;}Sleep(1000);}i=1;s++;printf(\t\t\tÍæ¼Òµ±Ç°%dµã\n,Rlayerscore);}intJudeg_B(){Randoms=rand()%(14-1+1)+1;while(Randoms==11){srand(time(0));Randoms=rand()%(14-1+1)+1;}if(Randoms10){Randoms=10;}if(Randoms==1){if(Bookiesscore+1121){Randoms=1;}else{Randoms=11;}}Bookiesscore+=Randoms;printf(\t\t\tÍæ¼Òµ±Ç°%dµãׯ¼Òµ±Ç°%dµã\n,Rlayerscore,Bookiesscore);}intJudge_WorL(){while(1){Game_interface();//ÓÎÏ·½çÃæif(Rlayer_score==0){printf(\t\t\tÄúÒѾûÓнð±ÒÁË£¡\n\t\t\tÓÎÏ·½áÊø£¡\n);break;}if(Bookies_score=0){printf(\t\t\tÄúÕæÀ÷º¦,ׯ¼ÒÒѾûÓнð±ÒÁË£¡\n\t\t\tÓÎÏ·½áÊø£¡\n\n\n);break;}printf(\t\t\t\tÍæ¼ÒÏÂ×¢£º);scanf(%d,&Bets_P);while(Bets_PRlayer_score){printf(\t\t\tÄúÏÂ×¢½ð±Ò³¬¹ýµ±Ç°½ð±ÒÊý£¡ÇëÖØÐÂÏÂ×¢£º);scanf(%d,&Bets_P);}printf(\n\t\t\tÓÎÏ·¿ªÊ¼,ϵͳ¿ªÊ¼·¢ÅÆ\n);while(1){Judge_C();i=2;if(Rlayerscore21){printf(\n\n\n\t\t\tÄãµÄµãÊý³¬¹ý21µã£¡ÄãÊäÁË£¡);Judge_M();s=1;break;}printf(\n\nÊÇ·ñ¼ÌÐø·¢ÅÆ£¿1ÊÇ/2·ñ);scanf(%d,&Card);if(Card==1){system(CLS);Game_interface();printf(\t\t\t\tÍæ¼ÒÏÂ×¢£º%d\n,Bets_P);}else{Judeg_B();if(Bookiesscore21){printf(\n\n\n\t\t\tׯ¼ÒµÄµãÊý³¬¹ý21µã£¡ÄãÓ®ÁË£¡);Rlayer_score=Rlayer_score+Bets_P;Bookies_score=Bookies_score-Bets_P;Bookiesscore=0;Rlayerscore=0;s=1;getch();system(CLS);i=1;break;}if(RlayerscoreBookiesscore){system(CLS);printf(\n\n\n\t\t\t\t¹§Ï²£¡ÄãÓ®ÁË£¡);Rlayer_score=Rlayer_score+Bets_P;Bookies_score=Bookies_score-Bets_P;Bookiesscore=0;Rlayerscore=0;i=1;s=1;getch();system(CLS);break;}else{if(Rlayerscore=Bookiesscore){printf(\n\n\n\t\t\t\t¶Ô²»Æð£¬ÄãÊäÁË£¡);Judge_M();s=1;break;}}}}}}intJudge_M(){Rlayer_score=Rlayer_score-Bets_P;Bookies_score=Bookies_score+Bets_P;Bookiesscore=0;Rlayerscore=0;i=1;getch();system(CLS);}//ÒÔÏÂΪÆË¿ËÅÆͼÐλæÖƵ÷Óú¯ÊýintNUM_A(){printf(©³©¥©¥©¥©¥©¥©·\n);printf(©§¡ô©§\n);printf(©§¡ô¡ô©§\n);printf(©§¡ô¡ô©§\n);printf(©§¡ô¡ô¡ô¡ô©§\n);printf(©§¡ô¡ô©§\n);printf(©»©¥©¥©¥©¥©¥©¿\n);}intNUM_2(){printf(©³©¥©¥©¥©¥©¥©·\n);printf(©§¡ô¡ô¡ô©§\n);printf(©§¡ô©§\n);printf(©§¡ô¡ô¡ô©§\n);printf(©§¡ô©§\n);printf(©§¡ô¡ô¡ô©§\n);printf(©»©¥©¥©¥©¥©¥©¿\n);}intNUM_3(){printf(©³©¥©¥©¥©¥©¥©·\n);printf(©§¡ô¡ô¡ô©§\n);printf(©§¡ô©§\n);printf(©§¡ô¡ô¡ô©§\n);printf(©§¡ô©§\n);printf(©§¡ô¡ô¡ô©§\n);printf(©»©¥©¥©¥©¥©¥©¿\n);}intNUM_4(){printf(©³©¥©¥©¥©¥©¥©·\n);printf(©§¡ô¡ô©§\n);printf(©§¡ô¡ô©§\n);printf(©§¡ô¡ô©§\n);printf(©§¡ô¡ô¡ô¡ô©§\n);printf(©§¡ô©§\n);printf(©»©¥©¥©¥©¥©¥©¿\n);}intNUM_5(){printf(©³©¥©¥©¥©¥©¥©·\n);printf(©§¡ô¡ô¡ô©§\n);printf(©§¡ô©§\n);printf(©§¡ô¡ô¡ô©§\n);printf(©§¡ô©§\n);printf(©§¡ô¡ô¡ô©§\n);printf(©»©¥©¥©
本文标题:C语言-21点游戏
链接地址:https://www.777doc.com/doc-7312167 .html