| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 820 人关注过本帖
标题:大家帮忙看看
取消只看楼主 加入收藏
hjb5074
Rank: 1
等 级:新手上路
帖 子:19
专家分:2
注 册:2012-5-31
结帖率:80%
收藏
已结贴  问题点数:20 回复次数:0 
大家帮忙看看
#include<stdbool.h>
#include<stdio.h>
#include<stdlib.h>
#include<time.h>

#define NUM_SUITS 4
#define NUM_RANKS 13

int main(void)
{
    bool in_hand[NUM_SUITS][NUM_RANKS] = {false};
    int num_cards,rank,suit;
    const char rank_code[] = {'2','3','4','5','6','7','8','9','t','j','q','k','a'};
    const char suit_code[] = {'c','d','h','s'};

    srand((unsigned) time(NULL));

    printf("Enter number of cards in hand:");
    scanf("%d",&num_cards);

    printf("Your hand:");
    while(num_cards > 0)
    {
        suit = rand() % NUM_SUITS;
        rank = rand() % NUM_RANKS;
        if(!in_hand[suit][rank])
        {
            in_hand[suit][rank] = true;
            num_cards--;
            printf(" %c%c",rank_code[rank],suit_code[suit]);
        }
    }
    printf("\n");

    return 0;
}
书上照抄的,怎么我在vc++中运行不了呀?提示:f:\编程学习\扑克.cpp(1) : fatal error C1083: Cannot open include file: 'stdbool.h': No such file or directory
搜索更多相关主题的帖子: void include number Enter 
2012-08-08 10:32
快速回复:大家帮忙看看
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.015919 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved