澳门威利斯人_威利斯人娱乐「手机版」

来自 网络资讯 2019-08-03 10:41 的文章
当前位置: 澳门威利斯人 > 网络资讯 > 正文

11万装修87平米3室1厅温馨美家,劣质代码评析

图片 1图片 2

图片 3

图片 4

0. #include <stdio.h>  1. #include <time.h>  2. #include <ctype.h>  3. #include <stdlib.h>  4.   5. #define BELL 'a'  6. #define DEALER 0  7. #define PLAYER 1  8.   9. #define ACELOW 0  10. #define ACEHIGH 1  11.   12. int askedForName = 0;  13.   14. void dispTitle(void);  15. void initCardsScreen(int cards[52],int playerPoints[2],  16. int dealerPoints[2], int total[2],   17. int *numCards);  18. int dealCard(int * numCards,int cards[52]);  19. void dispCard(int cardDrawn,int points[2]);  20. void totalIt(int points[2],int tatal[2],int who);  21. void dealerGetsCard(int *numCards,int cards[52],  22. int dealerPoints[2]);  23. void playerGetsCard(int *numCards,int cards[52],  24. int playerPoints[2]);  25. char getAns(char mesg[]);  26. void findWinner(int total[2]);  27.   28. main()  29. {  30.    int numCards;  31.    int cards[52],playerPoints[2],dealerPoints[2],total[2];  32.    char ans;  33.   34.    do   35.    {   36.       initCardsScreen(cards,playerPoints,dealerPoints,total, &numCards);  37.       dealerGetsCard(&numCards,cards, dealerPoints);  38.       printf("n");  39.       playerGetsCard(&numCards,cards,playerPoints);   40.       playerGetsCard(&numCards,cards,playerPoints);  41.       do  42.       {  43.          ans = getAns("Hit or stand (H/S)?");  44.          if ( ans == 'H' )  45.          {   46.             playerGetsCard(&numCards,cards,playerPoints);  47.          }    48.       }  49.       while( ans != 'S' );  50.   51.       totalIt(playerPoints,total,PLAYER);  52.       do  53.       {  54.          dealerGetsCard(&numCards,cards,dealerPoints);  55.       }  56.       while (dealerPoints[ACEHIGH] < 17 );  57.   58.       totalIt(dealerPoints,total,DEALER);  59.       findWinner(total);   60.   61.       ans = getAns("nPlay again(Y/N)?");    62.    }  63.    while(ans=='Y');  64.   65.    return ;  66.   67. }  68.   69. void initCardsScreen( int cards[52],int playerPoints[2],  70.                       int dealerPoints[2], int total[2],   71.                       int *numCards )  72. {  73.    int sub,val = 1 ;  74.    char firstName[15];  75.    *numCards=52;  76.   77.    for(sub=0;sub<=51;sub  )  78.    {  79.       val = (val == 14) ? 1 : val;  80.       cards[sub] = val;  81.       val  ;    82.    }  83.   84.    for(sub=0;sub<=1;sub  )  85.    {   86.       playerPoints[sub]=dealerPoints[sub]=total[sub]=0;  87.    }  88.    dispTitle();  89.   90.    if (askedForName==0)  91.    {   92.       printf("What is your first name?");  93.       scanf(" %s",firstName);  94.       askedForName=1;  95.       printf("Ok, %s,get ready for casino action!nn",firstName);  96.       getchar();  97.    }  98.    return;          99. }  100.   101. void playerGetsCard(int *numCards,int cards[52],int playerPoints[2])  102. {  103.    int newCard;  104.    newCard = dealCard(numCards, cards);  105.    printf("You draw:");  106.    dispCard(newCard,playerPoints);  107. }  108.   109.   110. void dealerGetsCard(int *numCards,int cards[52],int dealerPoints[2])  111. {  112.    int newCard;  113.    newCard = dealCard(numCards,cards);  114.    printf("The dealer draws:");  115.    dispCard(newCard,dealerPoints);  116. }  117.   118. int dealCard(int * numCards,int cards[52])  119. {  120.    int cardDrawn,subDraw;  121.    time_t t;  122.    srand(time(&t));  123.    subDraw = (rand()%(*numCards));  124.    cardDrawn = cards[subDraw];  125.    cards[subDraw] = cards[*numCards -1];  126.    (*numCards)-;  127.    return cardDrawn;  128. }  129.   130. void dispCard(int cardDrawn, int points[2])  131. {  132.    switch(cardDrawn)  133.    {  134.       case(11): printf("%sn","Jack");  135.                 points[ACELOW]  = 10;  136.                 points[ACEHIGH]  = 10;  137.                 break;  138.       case(12): printf("%sn","Queen");  139.                 points[ACELOW]  = 10;  140.                 points[ACEHIGH]  = 10;  141.                 break;  142.       case(13): printf("%sn","King");  143.                 points[ACELOW]  = 10;  144.                 points[ACEHIGH]  = 10;  145.                 break;  146.       default : points[ACELOW]  = cardDrawn;  147.                 if(cardDrawn==1)  148.                 {   149.                    printf("%sn","Ace");  150.                    points[ACEHIGH] = 11;  151.                 }  152.                 else  153.                 {    154.                   points[ACEHIGH] =cardDrawn;  155.                   printf("%dn",cardDrawn);   156.                 }  157.    }  158.    return ;  159. }  160.   161. void totalIt(int points[2],int total[2],int who)  162. {  163.    if ( (points[ACELOW] == points[ACEHIGH])  164.       ||(points[ACEHIGH] > 21 ))  165.    {   166.      total[who] = points[ACELOW];  167.    }  168.    else  169.    {   170.        total[who] = points[ACEHIGH];  171.    }  172.   173.    if (who == PLAYER )  174.    {  175.       printf("You have a total of %dnn", total[PLAYER]);  176.    }  177.    else  178.    {  179.        printf("The house stands with a total of %dnn",   180.        total[DEALER]);  181.    }  182.    return;  183. }  184.   185. void findWinner(int total[2])  186. {  187.    if ( total[DEALER] ==  21 )  188.    {  189.        printf("The house wins.n");  190.        return ;  191.    }  192.    if ( (total[DEALER] > 21) && (total[PLAYER] > 21) )  193.    {   194.       printf("%s", "Nobody wins.n");  195.       return ;   196.    }  197.    if ((total[DEALER] >= total[PLAYER])&& (total[DEALER] < 21))  198.    {   199.       printf("The house wins.n");  200.       return ;   201.    }  202.    if ((total[PLAYER] > 21)&& (total[DEALER] < 21))  203.    {   204.       printf("The house wins.n");  205.       return ;   206.    }  207.    printf("%s%c","You win!n",BELL);  208.    return;  209. }  210.   211. char getAns(char mesg[])  212. {  213.    char ans;  214.    printf("%s", mesg);  215.    ans = getchar();  216.    getchar();  217.    return toupper(ans);  218. }  219.   220. void dispTitle(void)  221. {  222.    int i = 0 ;  223.    while(i<25)  224.    {   225.         printf("n");  226.         i  ;   227.    }  228.    printf("nn*Step right up to the Blackjack tables*nn");  229.    return ;  230. }

大功告成线条清晰色块 黑白硬朗简约家居。越来越多>>>

40清晰大图秀87平3室1厅温馨美家客厅一点都非常的小侧边全客厅 窗口是止息榻 经常和恋人喝茶客厅沙发 图片 5

View Code

日本首都(Tokyo)--比斯开湾 无国界装修

40清晰大图秀87平3室1厅温馨美家客厅沙发区看餐厅区 图片 6

  庄家抽牌停止后,就到了发布胜负的时候。

天时地利中的衣橱相恋的人:衣柜变型计

40清晰大图秀87平3室1厅温馨美家时尚简约茶几 图片 7

26. void findWinner(int total[2]);    185. void findWinner(int total[2])  186. {  187.    if ( total[DEALER] ==  21 )  188.    {  189.        printf("The house wins.n");  190.        return ;  191.    }  192.    if ( (total[DEALER] > 21) && (total[PLAYER] > 21) )  193.    {   194.       printf("%s", "Nobody wins.n");  195.       return ;   196.    }  197.    if ((total[DEALER] >= total[PLAYER])&& (total[DEALER] < 21))  198.    {   199.       printf("The house wins.n");  200.       return ;   201.    }  202.    if ((total[PLAYER] > 21)&& (total[DEALER] < 21))  203.    {   204.       printf("The house wins.n");  205.       return ;   206.    }  207.    printf("%s%c","You win!n",BELL);  208.    return;  209. }

【直击第2届曼谷壁柜展:方寸间展中夏族民共和国定制】

40清晰大图秀87平3室1厅温馨美家客厅TV区TV柜 图片 8

  这些函数写得比较乱,贫乏系统。改成下边包车型地铁写法更清楚:

四月里的冰淇淋色家居

40清晰大图秀87平3室1厅温馨美家入户玄关处的生财盘 图片 9

本文由澳门威利斯人发布于网络资讯,转载请注明出处:11万装修87平米3室1厅温馨美家,劣质代码评析

关键词: 清晰 家居 硬朗 简约 图秀