标题:我想问这个程序有什么问题?
只看楼主
你爸边哭边
Rank: 1
等 级:新手上路
帖 子:39
专家分:0
注 册:2017-10-30
结帖率:66.67%
 问题点数:0 回复次数:3 
我想问这个程序有什么问题?
#include<stdio.h>

main()

{

float faHeight, moHeight, Height;

 

char sex, sport, diet;

 

printf("your sex(M or F)");

 

scanf(" %c",&sex);

 

if (sex == 'M')

{

printf("please enter your father's height\n");

 

scanf("%f",faHeight);

 

printf("please enter your mother's height\n");

 

scanf("%f",moHeight);

 

Height = (faHeight+ moHeight) * 54/100;

}

 

else if (sex == 'F')

 

{

printf("please enter your father's height\n");

 

scanf("%f",&faHeight);

 

printf("please enter your mother's heitht\n");

 

scanf("%f",&moHeight);

 

Height = (faHeight * 923/100 *moHeight)/2;

 

    }

 

printf("Do you like sports?(Y or N))\n");

 

scanf("%c",&sport);

 

scanf("%c",&sport);

 

if (sport == 'Y')

 

{

 

Height = Height*102/100;

 

}

 

else if (sport =='N')

 

{

 

Height = Height;

 

}

 

printf("Do you have good diet?(Y or N)");

 

scanf("%c",&diet);

 

scanf("%c",&diet);

 

if (diet == 'Y')

{

 

Height = Height*15/1000;

 

}

else if (diet == 'N')

{

 

Height = Height;

 

}

 

printf("your height=%f",Height);

 

}
搜索更多相关主题的帖子: printf scanf please enter Do 
2017-11-12 21:32
吹水佬
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:版主
威 望:432
帖 子:10064
专家分:41463
注 册:2014-5-20
得分:0 
不知道是什么问题
2017-11-13 14:41
自学的数学
Rank: 13Rank: 13Rank: 13Rank: 13
等 级:贵宾
威 望:46
帖 子:967
专家分:4146
注 册:2017-11-15
得分:0 
运行该程序,会提示  出现了一个问题,导致程序停止正常工作。请关闭该程序。
2017-11-16 00:17
htlnmvb
Rank: 2
等 级:论坛游民
帖 子:4
专家分:12
注 册:2017-8-1
得分:0 
scanf("%f",faHeight);

 

printf("please enter your mother's height\n");

 

scanf("%f",moHeight);取地址符掉了&
2017-11-16 03:44



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




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

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