• 抬起头,继续前进吧,去把这个不完美的故事,变成你成所期望的样子
  • 登山路上我们会放弃很多东西,但这些被我们丢掉在我们登上山顶之际,都会一一回来
  • 不论开发还是逆向,数学水平的高低直接决定了”你的饭碗里有没有肉”
  • 万丈高楼平地起,勿在浮沙筑高台

《C语言程序设计:现代方法》第十章练习

C 菜鸟 1年前 (2018-05-14) 10988次浏览 已收录 0个评论
[隐藏]

        本篇为菜鸟在学习《C 语言程序设计:现代方法》中第十章程序结构时做的练习题,如果有错误或疑问的话,欢迎大家指正~
【本练习代码风格已规范为:windows 风格。IDE 环境为 VS2017】

1、栈

修改栈示例使它存储字符而不是整数。接下来,增加 main 函数,用来要求用户输入一串圆括号或大括号,然后指出它们是否正常的嵌套
Enter parenteses and/or braces: ((){}{()})
Parenteses/braces are nested properly
提示:与程序读入字符一样,假设已经把每个左边圆括号或大括号压入栈中。当读入右边圆括号的右边大括号时,把栈顶的项弹出,并且检查弹出项是否是匹配的圆括号或大括号。
如果不是则圆括号或大括号嵌套不正确。当程序读入换行符时,检查栈是否为空。如果为空,那么圆括号或大括号匹配;如果栈不为空(或者如果曾经调用过 stack_underflow 函数),
那么原括号或大括号匹配;如果栈不为空(或者曾经调用过 stack_underflow 函数),那么圆括号或大括号不匹配。如果调用 stack_underflow 函数,程序显示信息 Stack overflow,并且立刻终止
答:

#include <stdio.h>
#include <stdlib.h>

#define STACK_SIZE 5
#define TURE 1
#define FALSE 0

typedef int Bool;

int g_aiContents[STACK_SIZE] = { 0 };
int g_iTop = 0;

void StackUnderflow(void);
void StatckOverflow(void);
void makeEmpty(void);
Bool IsEmpty(void);
Bool IsFull(void);
void Push(int iData);
int Pop(void);

int main()
{
    char cChar = '\0';
    char cCheckSign = '\0';

    printf("Enter parenteses and/or brace: ");
    while ((cChar = getchar()) != '\n')
    {
        if ((cChar == ')') || (cChar == '}'))
        {
            cCheckSign = Pop();
            if ((cCheckSign != '(') && (cCheckSign != '{'))
            {
                break;
            }
        }
        else
        {
            Push((int)cChar);
        }
    }

    if (g_iTop == 0)
    {
        printf("Parenteses/braces are nested properly\r\n");
    }
    else
    {
        printf("Parenteses/braces are not nested properly\r\n");
    }

    system("pause");
    return 0;
}

void StackUnderflow(void)
{
    printf("Stack underflow\n");
    exit(EXIT_FAILURE);
}

void StatckOverflow(void)
{
    printf("Stack overflow\n");
    exit(EXIT_FAILURE);
}

void makeEmpty(void)
{
    g_iTop = 0;
}

Bool IsEmpty(void)
{
    return g_iTop == 0;
}

Bool IsFull(void)
{
    return g_iTop == STACK_SIZE;
}

void Push(int iData)
{
    if (IsFull())
    {
        StatckOverflow();
    }
    else
    {
        g_aiContents[g_iTop++] = iData;
    }
}

int Pop(void)
{
    if (IsEmpty())
    {
        StackUnderflow();
    }
    else
    {
       return g_aiContents[--g_iTop];
    }

    return FALSE;
}

2、作用域

下面的程序框架只显示了函数定义和变量声明
int a;

void f(int b)
{
int c;
}
void g(void)
{
int d;
{
int e;
}
}
main()
{
int f;
}
对于下面每种作用域,列出在此作用域内的所有变量的名字和形式参数的名字:
(a) f 函数。
(b) g 函数
(c) 声明 e 的程序块
(d) main 函数
答:
(a) 变量 a、c , 形参 b
(b) 变量 a、d
(c) 变量 a、e、d
(d) 变量 a、f

3、程序修改 1

修改 poker.c 程序,把数组 num_in_rank 和数组 num_in_suit 移入 main 函数。main 函数将把这两个数组作为实际参数传递给 read_cards 函数和 analyze_hand
答:

#include <stdio.h>
#include <stdlib.h>

#define TRUE 1
#define FALSE 0
#define NUM_CARDS 5
#define NUM_SUITS 4
#define NUM_RANKS 13
#define IN
#define OUT
#define PUBLIC
#define PRIVATE static

typedef int Bool;

Bool g_bStraight = FALSE;
Bool g_bFlush = FALSE;
Bool g_bFour = FALSE;
Bool g_bThree = FALSE;
int iPairs = 0;

PRIVATE void ReadCards(OUT int aiNumInRank[], OUT int aiNumInSuit[]) ;
PRIVATE void AnalyzeHand(IN int aiNumInRank[], IN int aiNumInSuit[]);
PRIVATE void PrintResult(void);

int main()
{
    int aiNumInRank[NUM_RANKS] = { 0 };
    int aiNumInSuit[NUM_SUITS] = { 0 };

    for (;;)
    {
        ReadCards(aiNumInRank, aiNumInSuit);
        AnalyzeHand(aiNumInRank, aiNumInSuit);
        PrintResult();
    }

    system("pause");
    return 0;
}

PRIVATE void ReadCards(OUT int aiNumInRank[], OUT int aiNumInSuit[])
{
    Bool abCardExists[NUM_RANKS][NUM_SUITS] = { 0 };
    char cTmp = '\0';
    char cRank = '\0';
    char cSuit = '\0';
    int cntRank = 0;
    int cntSuit = 0;
    int iCardsRead = 0;
    Bool bHasBadCard = FALSE;

    for (cntRank = 0; cntRank < NUM_RANKS; cntRank++)
    {
        aiNumInRank[cntRank] = 0;
        for (cntSuit = 0; cntSuit < NUM_SUITS; cntSuit++)
        {
            abCardExists[cntRank][cntSuit] = FALSE;
        }
    }

    for (cntSuit = 0; cntSuit < NUM_SUITS; cntSuit++)
    {
        aiNumInSuit[cntSuit] = 0;
    }

    while (iCardsRead < NUM_CARDS)
    {
        bHasBadCard = FALSE;

        printf("Enter a card: ");
        cRank = (char)getchar();
        switch (cRank)
        {
            case '0':
            {
                exit(EXIT_SUCCESS);
            }
            case '2':
            {
                cntRank = 0;
                break;
            }
            case '3':
            {
                cntRank = 1;
                break;
            }
            case '4':
            {
                cntRank = 2;
                break;
            }
            case '5':
            {
                cntRank = 3;
                break;
            }
            case '6':
            {
                cntRank = 4;
                break;
            }
            case '7':
            {
                cntRank = 5;
                break;
            }
            case '8':
            {
                cntRank = 6;
                break;
            }
            case '9':
            {
                cntRank = 7;
                break;
            }
            case 't':
            case 'T':
            {
                cntRank = 8;
                break;
            }
            case 'j':
            case 'J':
            {
                cntRank = 9;
                break;
            }
            case 'q':
            case 'Q':
            {
                cntRank = 0;
                break;
            }
            case 'k':
            case 'K':
            {
                cntRank = 0;
                break;
            }
            default:
            {
                bHasBadCard = TRUE;
                break;
            }
        } //! switch END

        cSuit = (char)getchar();
        switch (cSuit)
        {
            case 'c':
            case 'C':
            {
                cntSuit = 0;
                break;
            }
            case 'd':
            case 'D':
            {
                cntSuit = 1;
                break;
            }
            case 'h':
            case 'H':
            {
                cntSuit = 2;
                break;
            }
            case 's':
            case 'S':
            {
                cntSuit = 3;
                break;
            }
            default:
            {
                bHasBadCard = TRUE;
                break;
            }
        } //! switch END

        while ((cTmp = (char)getchar()) != '\n')
        {
            if (cTmp != ' ')
            {
                bHasBadCard = TRUE;;
            }
        }

        if (bHasBadCard)
        {
            printf("Bad card; ignored.\r\n");
        }
        else if (abCardExists[cntRank][cntSuit])
        {
            printf("Duplicate card; ignored.\r\n");
        }
        else
        {
            aiNumInRank[cntRank]++;
            aiNumInSuit[cntSuit]++;
            abCardExists[cntRank][cntSuit] = TRUE;
            iCardsRead++;
        }
    } //! while END
} //! ReadCards() END


PRIVATE void AnalyzeHand(IN int aiNumInRank[], IN int aiNumInSuit[])
{
    int iConsecNum = 0;
    size_t iRank = 0;
    size_t iSuit = 0;

    g_bStraight = FALSE;
    g_bFlush = FALSE;
    g_bFour = FALSE;
    g_bThree = FALSE;
    iPairs = 0;

    for (iSuit = 0; iSuit < NUM_SUITS; iSuit++)
    {
        if (aiNumInSuit[iSuit] == NUM_CARDS)
        {
            g_bFlush = TRUE;
        }
    }

    while (aiNumInRank[iRank] == 0)
    {
        iRank++;
    }

    for (; iRank < NUM_RANKS && aiNumInRank[iRank]; iRank++)
    {
        iConsecNum++;
    }

    if (iConsecNum == NUM_CARDS)
    {
        g_bStraight = TRUE;
        return;
    }

    for (iRank = 0; iRank < NUM_RANKS; iRank++)
    {
        if (aiNumInRank[iRank] == 4)
        {
            g_bFour = TRUE;
        }

        if (aiNumInRank[iRank] == 3)
        {
            g_bThree = TRUE;
        }

        if (aiNumInRank[iRank] == 2)
        {
            iPairs++;
        }
    }
}

PRIVATE void PrintResult(void)
{
    if (g_bStraight && g_bFlush)
    {
        printf("Straight flush\n\n");
    }
    else if (g_bFour)
    {
        printf("Four of a kind\n\n");
    }
    else if (g_bThree && iPairs == 1)
    {
        printf("Full house\n\n");
    }
    else if (g_bFlush)
    {
        printf("Flush\n\n");
    }
    else if (g_bStraight)
    {
        printf("Straight\n\n");
    }
    else if (g_bThree)
    {
        printf("Three of a kind\n\n");
    }
    else if (iPairs == 2)
    {
        printf("Two pairs\n\n");
    }
    else if (iPairs == 1)
    {
        printf("Pair\n\n");
    }
    else
    {
        printf("High card\n\n");
    }
} //! PrintResult() END

4、程序修改 2

a、修改 poker.c 程序,把数组 num_in_rank、数组 num_in_suit 和数组 card_exists 从 poker.c 程序中去掉。程序改用 5×2 的数组来代替存储牌
b、修改 poker.c 程序,使其识别牌的额外类别——”同花大顺”(A、K、Q、J,以及同样花色的 10)。
同花大顺的级别高于其他所有的类别
c、修改 poker.c 程序,使其允许”小 A 顺”(即 A、2、3、4 和 5)。
答:
Boolenv.h

//版权:Copyright 2018 www.xuexixinde.com
//许可: Free
//作者: 菜鸟
//描述:
//  定义布尔宏和布尔类型
//
#pragma once
#ifndef BOOLENV_H_
#define BOOLENV_H_

#define TRUE 1
#define FALSE 0

typedef int Bool;

#endif // !BOOLENV_H_

Macroshare.h
<pre class="prettyprint linenums" >
//版权:Copyright 2018 www.xuexixinde.com
//许可: Free
//作者: 菜鸟
//描述:
//  定义需要共享的宏
//
#pragma once

#ifndef MACROSHARE_H_
#define MACROSHARE_H_

#define NUM_CARDS 5

#define CARD_INFO_NUMBER 2
#define CARD_VALUE 0
#define CASE_COLOUR 1

//说明性宏
#define OUT
#endif // !MACROSHARE_H_

pokerFun.h

//版权:Copyright 2018 www.xuexixinde.com
//许可: Free
//作者: 菜鸟
//描述:
//  关于扑克函数的声明
//
#pragma once

#ifndef POKERFUN_H_
#define POKERFUN_H_

//功能:读取用户输入的手牌,并检测是否是坏牌
//输出:显示读取 UI 以及输出错误提示
//返回值:无
//参数:
//  acCardInfo:存储牌面信息的数组
//注意事项:
//  1、所有参数不可为 NULL
void ReadCards(char acCardInfo[][CARD_INFO_NUMBER]);

//功能:分析手牌类型
//输出:无
//返回值:无
//参数:
//  acCardInfo:存储牌面信息的数组
//  bBigFlag:大顺子标识(原值会做更改)
//  bLittleFlag:小顺子标识(原值会做更改)
//  bStraight:顺子标识(原值会做更改)
//  bFlush:同花标识(原值会做更改)
//  bFour:相同 4 张标识(原值会做更改)
//  bThree:相同 3 张标识(原值会做更改)
//  iPairs:对子数量(原值会做更改)
//注意事项:
//  1、所有参数不可为 NULL
void AnalyzeHand(char acCardInfo[][CARD_INFO_NUMBER],
                 OUT Bool *bBigFlag,
                 OUT Bool *bLittleFlag,
                 OUT Bool *bStraight,
                 OUT Bool *bFlush,
                 OUT Bool *bFour,
                 OUT Bool *bThree,
                 OUT int *iPairs);

//功能:分析手牌
//输出:显示读取 UI 以及输出错误提示
//返回值:无
//参数:
//  bBigFlag:大顺子标识
//  bLittleFlag:小顺子标识
//  bStraight:顺子标识
//  bFlush:同花标识
//  bFour:相同 4 张标识
//  bThree:相同 3 张标识
//  iPairs:对子数量
//注意事项:
//  1、所有参数不可为 NULL
void PrintResult(Bool bBigFlag,
                 Bool bLittleFlag,
                 Bool bStraight,
                 Bool bFlush,
                 Bool bFour,
                 Bool bThree,
                 int iPairs);

//功能:转换扑克字母为数字
//输出:无
//返回值:无
//参数:
//  iTargetNumber:目标值
//  iResultNumber:转换结果值
//注意事项:
//  1、所有参数不可为 NULL
void ConvertPokerAlpha(int iTargetNumber, OUT int *iResultNumber);
#endif // !POKERFUN_H_

Launch.c

//版权:Copyright 2018 www.xuexixinde.com
//许可: Free
//作者: 菜鸟
//描述:
//  起始函数,通过调用 pokerFun 文件中的函数来实现功能
//
#include <stdio.h>
#include <stdlib.h>
#include "Boolenv.h"
#include "Macroshare.h"
#include "pokerFun.h"

int main()
{
    char acCardInfo[NUM_CARDS][CARD_INFO_NUMBER] = { {0} };
    Bool bBigFlag = FALSE;
    Bool bLittleFlag = FALSE;
    Bool bStraight = FALSE;
    Bool bFlush = FALSE;
    Bool bFour = FALSE;
    Bool bThree = FALSE;
    int iPairs = 0;

    for (;;)
    {
        bBigFlag = FALSE;
        bLittleFlag = FALSE;
        bStraight = FALSE;
        bFlush = FALSE;
        bFour = FALSE;
        bThree = FALSE;
        iPairs = 0;

        ReadCards(acCardInfo);

        AnalyzeHand(acCardInfo,
                    &bBigFlag,
                    &bLittleFlag,
                    &bStraight,
                    &bFlush,
                    &bFour,
                    &bThree,
                    &iPairs);

        PrintResult(bBigFlag,
                    bLittleFlag,
                    bStraight,
                    bFlush,
                    bFour,
                    bThree,
                    iPairs);
    } //! for END
} //! main() END

pokerFun.c

//版权:Copyright 2018 www.xuexixinde.com
//许可: Free
//作者: 菜鸟
//描述:
//  关于扑克函数的定义
//
#include <stdlib.h>
#include <stdio.h>
#include "Boolenv.h"
#include "Macroshare.h"
#include "pokerFun.h"

//通过 getchar()读入如果是 0 则退出,且空格会被判断为坏牌
//使用遍历进行相同牌的判断
//超出牌面的信息也会判断为坏牌
//没有相同的牌或坏牌则读取下一个
void ReadCards(char acCardInfo[][CARD_INFO_NUMBER])
{
    char cInputChar = '\0';
    int cntI = 0;
    int cntJ = 0;
    int iCardsRead = 0;
    Bool bBadCard = FALSE;
    Bool bHasPlurality = FALSE;

    for (cntI = 0; cntI < NUM_CARDS; cntI++)
    {
        for (cntJ = 0; cntJ < CARD_INFO_NUMBER; cntJ++)
        {
            acCardInfo[cntI][cntJ] = '\0';
        }
    }

    while (iCardsRead < NUM_CARDS)
    {
        bBadCard = FALSE;
        bHasPlurality = FALSE;

        printf("Enter a Card: ");
        for (cntI = 0; cntI < CARD_INFO_NUMBER; cntI++)
        {
            acCardInfo[iCardsRead][cntI] = (char)getchar();
            if (acCardInfo[iCardsRead][cntI] == '0')
            {
                exit(EXIT_FAILURE);
            }
        }

        while ((cInputChar = (char)getchar()) != '\n')
        {                  
            if (cInputChar != ' ')
            {              
                bBadCard = TRUE;
            }              
        }

        for (cntI = 0; cntI < iCardsRead; cntI++)
        {
            if (acCardInfo[iCardsRead][0] == acCardInfo[cntI][0] &&
                acCardInfo[iCardsRead][1] == acCardInfo[cntI][1])
            {
                bHasPlurality = TRUE;
                break;
            }
        }

        switch (acCardInfo[iCardsRead][0])
        {
            case '2':
            case '3':
            case '4':
            case '5':
            case '6':
            case '7':
            case '8':
            case '9':
            case 't':
            case 'T':
            case 'j':
            case 'J':
            case 'q':
            case 'Q':
            case 'k':
            case 'K':
            case 'a':
            case 'A':
            {
                break;
            }
            default:
            {
                bBadCard = TRUE;
                break;
            }
        } // !  switch END

        switch (acCardInfo[iCardsRead][1])
        {
            case 'c':
            case 'C':
            case 'd':
            case 'D':
            case 'h':
            case 'H':
            case 's':
            case 'S':
            {
                break;
            }
            default:
            {
                bBadCard = TRUE;
                break;
            }
        }

        if (bBadCard == TRUE)
        {
            printf("Bad card, ignored.\r\n");
        }
        else if (bHasPlurality == TRUE)
        {
            printf("Duplicate card, ignored.\r\n");
        }
        else
        {
            iCardsRead++;
        }

    } // ! while END
} // ! ReadCards() END

//首先对牌面信息进行排序
//然后检查五张牌是否同花色、是否按加 1 顺序排列
//其中特殊处理大顺子和小顺子
//最后判断相同牌的数量和对子的数量
void AnalyzeHand(char acCardInfo[][CARD_INFO_NUMBER],
                 OUT Bool *bBigFlag,
                 OUT Bool *bLittleFlag,
                 OUT Bool *bStraight,
                 OUT Bool *bFlush,
                 OUT Bool *bFour,
                 OUT Bool *bThree,
                 OUT int *iPairs)
{
    int cntI = 0;
    int cntJ = 0;
    int iSuitSameName = 0;
    int iFirstTemp = 0;
    int iSecondTemp = 0;
    int cntSameCard = 0;
    int cntOrderNumber = 0;
    char cSignCard = '\0';
    char cSuit = '\0';
    char cTempChar = '\0';

    //牌面信息排序
    for (cntI = 0; cntI < NUM_CARDS - 1; cntI++)
    {
        for (cntJ = cntI + 1; cntJ < NUM_CARDS; cntJ++)
        {
            ConvertPokerAlpha(acCardInfo[cntI][CARD_VALUE], &iFirstTemp);
            ConvertPokerAlpha(acCardInfo[cntJ][CARD_VALUE], &iSecondTemp);
            if (iFirstTemp > iSecondTemp)
            {
                cTempChar = acCardInfo[cntJ][CARD_VALUE];
                acCardInfo[cntJ][CARD_VALUE] = acCardInfo[cntI][CARD_VALUE];
                acCardInfo[cntI][CARD_VALUE] = cTempChar;

                cTempChar = acCardInfo[cntJ][CASE_COLOUR];
                acCardInfo[cntJ][CASE_COLOUR] = acCardInfo[cntI][CASE_COLOUR];
                acCardInfo[cntI][CASE_COLOUR] = cTempChar;
            }
        }
    }

    //检查是否是同花
    cSuit = acCardInfo[0][1];
    for (cntI = 1; cntI < NUM_CARDS; cntI++)
    {
        if (cSuit == acCardInfo[cntI][CASE_COLOUR])
        {
            iSuitSameName++;
        }
    }

    if (iSuitSameName == (NUM_CARDS - 1))
    {
        *bFlush = TRUE;
    }

    for (cntI = 0; cntI < NUM_CARDS - 1; cntI++)
    {
        ConvertPokerAlpha(acCardInfo[cntI][CARD_VALUE], &iFirstTemp);
        ConvertPokerAlpha(acCardInfo[cntI + 1][CARD_VALUE], &iSecondTemp);

        if (iFirstTemp + 1 == iSecondTemp)
        {
            cntOrderNumber++;
        }

        if (iSecondTemp == 13 &&
            acCardInfo[0][CARD_VALUE] == 'a'
            || acCardInfo[0][CARD_VALUE] == 'A')
        {
            cntOrderNumber++;
        }
    }

    //检查是否是顺子
    if (cntOrderNumber == 4)
    {
        *bStraight = TRUE;
        if ((acCardInfo[0][CARD_VALUE] == 'a' 
             || acCardInfo[0][CARD_VALUE] == 'A') &&
            acCardInfo[1][CARD_VALUE] == '2')
        {
            *bLittleFlag = TRUE;
        }
        else if ((acCardInfo[0][CARD_VALUE] == 'a'
                  || acCardInfo[0][CARD_VALUE] == 'A') &&
                 (acCardInfo[1][CARD_VALUE] == 't'
                  || acCardInfo[1][CARD_VALUE] == 'T'))
        {
            *bBigFlag = TRUE;
        }
        return;
    }

    //检查相同牌数量和对子数量
    cSignCard = acCardInfo[0][CARD_VALUE];
    cntSameCard = 1;
    for (cntI = 1; cntI <= NUM_CARDS; cntI++)
    {
        if (cntI == NUM_CARDS
            || cSignCard != acCardInfo[cntI][CARD_VALUE])
        {
            if (cntI < NUM_CARDS)
            {
                cSignCard = acCardInfo[cntI][CARD_VALUE];
            }

            if (cntSameCard == 4)
            {
                *bFour = TRUE;
            }
            else if (cntSameCard == 3)
            {
                *bThree = TRUE;
            }
            else if (cntSameCard == 2)
            {
                (*iPairs)++;
            }

            cntSameCard = 1;
        }
        else
        {
            cntSameCard++;
        }
    } //! for END
} //! AnalyzeHand() END

//除了字母字符要转为响应的值需要特殊处理
//数字字符直接减去字符'0'
void ConvertPokerAlpha(int iTargetNumber, OUT int *iResultNumber)
{
    switch (iTargetNumber)
    {
        case 'a':
        case 'A':
        {
            *iResultNumber = 1;
            break;
        }
        case 't':
        case 'T':
        {
            *iResultNumber = 10;
            break;
        }
        case 'j':
        case 'J':
        {
            *iResultNumber = 11;
            break;
        }
        case 'q':
        case 'Q':
        {
            *iResultNumber = 12;
            break;
        }
        case 'k':
        case 'K':
        {
            *iResultNumber = 13;
            break;
        }
        default:
        {
            *iResultNumber = iTargetNumber - '0';
            break;
        }
    } //! switch END
} //! ConvertPokerAlpha() END

//通过判断各种标识来显示对应内容
void PrintResult(Bool bBigFlag,
                 Bool bLittleFlag,
                 Bool bStraight,
                 Bool bFlush,
                 Bool bFour,
                 Bool bThree,
                 int iPairs)
{
    if (bBigFlag && bStraight && bFlush)
    {
        printf("Big Straight flush!\r\n\n");
    }
    else if (bStraight && bFlush)
    {
        printf("Straight flush\r\n\n");
    }
    else if (bFour)
    {
        printf("Four of a kind\r\n\n");
    }
    else if (bThree && iPairs == 1)
    {
        printf("Full house\r\n\n");
    }
    else if (bFlush)
    {
        printf("Flush\r\n\n");
    }
    else if (bBigFlag && bStraight)
    {
        printf("Big Straight\r\n\n");
    }
    else if (bStraight)
    { 
        if (bLittleFlag)
        {
            printf("Little Straight\r\n\n");
        }
        else
        {
            printf("Straight\r\n\n");
        }
    }
    else if (bThree)
    {
        printf("Three of a kind\r\n\n");
    }
    else if (iPairs == 2)
    {
        printf("Two Pairs\r\n\n");
    }
    else if (iPairs == 1)
    {
        printf("Pair\r\n\n");
    }
    else
    {
        printf("High card\r\n\n");
    }
} //! PrintResult() END

学习心得 , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明《C 语言程序设计:现代方法》第十章练习
喜欢 (1)
[]
分享 (0)
发表我的评论
取消评论
表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址