我的这个C语言程序为什么错了啊

[复制链接]
查看11 | 回复2 | 2010-3-31 23:43:32 | 显示全部楼层 |阅读模式
三点:1.double对应的是%lf,float对应的是%f;2.else if(t>=25&&t>27)应该是else if (t >= 25 && t =27); 此处的t>=27是多余的,更不应该有分号。
回复

使用道具 举报

千问 | 2010-3-31 23:43:32 | 显示全部楼层
最后一个else后面不用跟(t>=27); 直接就是else printf("your weight is too heigh");
回复

使用道具 举报

千问 | 2010-3-31 23:43:32 | 显示全部楼层
double要用%lf#includevoid main(){ double h,w,t; printf("please input your height\n"); printf("h="); scanf("%lf",&h); printf("please input your weight\n"); printf("w="); scanf("%lf",&w); printf("t="); t=(w/(h*h)); printf("%8.4lf\n",t); if(t=18&&t=25&&t<27) printf("You are over weight"); else printf("Your weight is too high");}
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行