标题:[求助]为啥这代码在编译时显示许多变量没定义
只看楼主
zsx369530691
Rank: 1
等 级:新手上路
帖 子:4
专家分:0
注 册:2007-10-13
 问题点数:0 回复次数:0 
[求助]为啥这代码在编译时显示许多变量没定义

#include<math.h>
main()
{
char sex;
char sports;
char diet;

float myHeight;
float faHeight;
float moHeight;
printf("Are you a boy(M) or a girl(F)?");
scanf("% c", &sex);
printf("please input your father's height(cm):");
scanf("%f", &faHeight);
printf("please input your mother's height(cm):");
scanf("%f",&moHeight);
printf("DO you have a good habit of diet(Y/N)?");
scanf("%c",&diet);

printf("do you like sports(Y/N)?");
scanf("%c",&sports);
if(sex ==`M` || sex ==`m`)
myheight = (faHeight + moHeight)*0.54;
else
myheight = (faHeight *0.923 +moHeight) / 2.0;
if(sports == `y` || sports ==`Y`)
myHeight =myHeight * (1 + 0.02);
if(diet ==`Y` || diert ==`y`)
myHeight = myHeight * (1 + 0.015);
printf("your future height will be %f(cm)\n",myHeight);

}

搜索更多相关主题的帖子: 变量 定义 编译 代码 
2007-10-20 17:01



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-179339-1-1.html




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

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