c语言中没有<stdbool>,输出不了程序,求高人指点!

/*Program7.10Understandpointerstoyourhatsizeifyoudare*/#include<stdio.h>#include<stdb... /* Program 7.10 Understand pointers to your hat size if you dare */
#include <stdio.h>
#include <stdbool.h>

int main(void)
{
char size[3][12] = { /* Hat sizes as characters */
{'6', '6', '6', '6', '7', '7', '7', '7', '7', '7', '7', '7'},
{'1', '5', '3', '7', ' ', '1', '1', '3', '1', '5', '3', '7'},
{'2', '8', '4', '8', ' ', '8', '4', '8', '2', '8', '4', '8'}
};

int headsize[12] = /* Values in 1/8 inches */
{164,166,169,172,175,178,181,184,188,191,194,197};

char *psize = *size;
int *pheadsize = headsize;

float cranium = 0.0; /* Head circumference in decimal inches */
int your_head = 0; /* Headsize in whole eighths */
bool hat_found = false; /* Indicates when a hat is found to fit */
bool too_small = false; /* Indicates headsize is too small */

/* Get the circumference of the head */
printf("\nEnter the circumference of your head above your eyebrows"
" in inches as a decimal value: ");
scanf(" %f", &cranium);
/* Convert to whole eighths of an inch */
your_head = (int)(8.0*cranium);
/* Search for a hat size */
for(int i = 0 ; i < 12 ; i++)
{
/* Find head size in the headsize array */
if(your_head > *(pheadsize+i))
continue;

/* If it is the first element and the head size is */
/* more than 1/8 smaller then the head is too small */
/* for a hat */
if((i == 0) && (your_head < (*pheadsize)-1))
{
printf("\nYou are the proverbial pinhead. No hat for"
"you I'm afraid.\n");
too_small = true;
break; /* Exit the loop */
}

/* If head size is more than 1/8 smaller than the current */
/* element in headsize array, take the next element down */
/* as the head size */
if( your_head < *(pheadsize+i)-1)
i--;

printf("\nYour hat size is %c %c%c%c\n",
*(psize + i), /* First row of size */
*(psize + 1*12 + i), /* Second row of size */
(i==4) ?' ' : '/',
*(psize+2*12+i)); /* Third row of size */
hat_found=true;
break;
}
if(!hat_found && !too_small)
printf("\nYou, in technical parlance, are a fathead."
" No hat for you, I'm afraid.\n");
return 0;
}
展开
 我来答
百度网友10c6f4b
2013-10-14 · TA获得超过612个赞
知道小有建树答主
回答量:1082
采纳率:100%
帮助的人:216万
展开全部
把那#include<stdbool.h>
改为以下三行.
#define bool int
#define false 0
#define true 1
换符合C99标准的编译器吧,凡是1999年以后出的编译器都行,如vs,gcc.
百度网友a5eb3e1
2013-10-14 · TA获得超过4447个赞
知道大有可为答主
回答量:3486
采纳率:60%
帮助的人:2616万
展开全部
/*
stdbool.h 

-- Boolean type and values
(substitute for missing C99 standard header)

public-domain implementation from [EMAIL PROTECTED]

implements subclause 7.16 of ISO/IEC 9899:1999 (E)
*/

#ifndef __bool_true_false_are_defined
#define __bool_true_false_are_defined 1

/* program is allowed to contain its own definitions, so ... */
#undef bool
#undef true
#undef false

#if __STDC_VERSION__ < 199901
typedef int _Bool
#endif

#define bool _Bool
#define true 1
#define false 0

#endif /* !defined(__bool_true_false_are_defined) */
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
用QQ名居然违规
2013-10-14 · TA获得超过1110个赞
知道小有建树答主
回答量:1057
采纳率:50%
帮助的人:412万
展开全部
bool改int
#include <stdbool.h>这一行不要
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 更多回答(1)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式