c语言编好无错误 运行时出错,编译成功且未提示有任何错误但运行时提示Bad command or filename是怎么回事 ......

编译成功且未提示有任何错误但运行时提示Bad command or filename是怎么回事?

这是Kochan所编的<>中的一个例题,但运行时为什么回出现如题状况呢?我所采用的运行平台为Turbo C for Windows.换用其它运行平台时依然如此.我的文件命名应该没问题的啊,文件名为dateUpdate.C

#include

#include

struct date

{

int month;

int day;

int year;

};

int main(void)

{

struct date today,tomorrow;

int numberOfDays(struct date d);

printf ("please type in today's date(mm dd yyyy):");

scanf ("%i%i%i",&today.month,&today.day,&today.year);

if (today.day != numberOfDays(today))

{

tomorrow.day=today.day+1;

tomorrow.month=today.month;

tomorrow.year=today.year;

}

else if (today.month == 12)

{

tomorrow.day=1;

tomorrow.month=1;

tomorrow.year=today.year + 1;

}

else

{

tomorrow.day=1;

tomorrow.month=today.month + 1;

tomorrow.year=today.year;

}

printf ("tomorrow's date is %i/%i/%.2i.\n",tomorrow.month,tomorrow.day,tomorrow.year % 100);

return 0;

}

/*判断是否为闰年的函数*/

bool isLeapYear(struct date d)

{

bool LeapYearFlag;

if (d.year % 4 ==0 && d.year % 100 != 0 || d.year % 400 == 0)

LeapYearFlag = true;

else

LeapYearFlag = false;

return LeapYearFlag;

}

/*查找一个月中日期数的函数*/

int numberOfDays (struct date d)

{

int days;

bool isLeapYear (struct date d);

const int daysPerMonth[12] = {31,28,31,30,31,30,31,31,30,31,30,31};

if (isLeapYear(d) == true && d.month == 2)

days = 29;

else

days = daysPerMonth[d.month - 1];

return days;

}----------------解决方案--------------------------------------------------------

在  DEV C++ 下面 可以成功编译和运行!

----------------解决方案--------------------------------------------------------

bool????

用c++编译器,把文件名改为.cpp

----------------解决方案--------------------------------------------------------

以下是引用caohuolong在2007-10-22 18:17:58的发言:

在 DEV C++ 下面 可以成功编译和运行!

那确实,我也试了一下,为什么会这样呢?怎么DEV CPP下没问题,而TURBO C却不行呢?我明明用的是C教程啊

----------------解决方案--------------------------------------------------------

我刚刚看了一下安装目录,发现INCLUDE文件夹中根本就没有头文件stdbool.h是这个头文件的确实导致的吗?该如何解决,头文件有没有什么地方可以下载扩充.

----------------解决方案--------------------------------------------------------

难道没有人知道吗?急救~~~~~

----------------解决方案--------------------------------------------------------

汗,我用的也是这个编译器,也是报这个错.....

有的时候同样的程序,文件名长点就报错,重命名个短点的名字 就好了 完全不知道为什么.....

----------------解决方案--------------------------------------------------------

我也有错找不到stdbool.h

Cannot open include file: 'stdbool.h': No such file or directory

我还没看见过它,说实话,vc下没有它,看看gcc有不

----------------解决方案--------------------------------------------------------

见鬼了,这老外用的什么编译器啊?

DEV CPP可以运行,但是在Include文件夹中也找不到stdbool.h文件

真的是搞坨不清.

----------------解决方案--------------------------------------------------------

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值