标题:C程序无法正常使用,各位大佬出来多多指导一下,谢谢了!
只看楼主
谌123
Rank: 1
来 自:中国四川绵阳三台
等 级:新手上路
帖 子:7
专家分:0
注 册:2018-8-31
 问题点数:0 回复次数:3 
C程序无法正常使用,各位大佬出来多多指导一下,谢谢了!
/*根据身高体重测量BMI值*/
#include<stdio.h>
float BMI(float height, float weight);

int main()
{
      float height;
      float weight;
      float BMI;


      printf("请输入您的身高: \n");
      scanf("%f",&height);
      printf("请输入您的体重: ");
      scanf("%f",&weight);
      BMI=(height,weight);
      printf("您的BMI为:");
      printf("%.2f\n",BMI);
      return 0;


}

    float BMI(float height, float weight)
{
float BMI =(weight*height);
return BMI;
}

[此贴子已经被作者于2018-8-31 20:10编辑过]

搜索更多相关主题的帖子: 多多 float printf 输入 scanf 
2018-08-31 20:04
谌123
Rank: 1
来 自:中国四川绵阳三台
等 级:新手上路
帖 子:7
专家分:0
注 册:2018-8-31
得分:0 
拜托了

[此贴子已经被作者于2018-8-31 20:10编辑过]

2018-08-31 20:07
谌123
Rank: 1
来 自:中国四川绵阳三台
等 级:新手上路
帖 子:7
专家分:0
注 册:2018-8-31
得分:0 
2018-08-31 20:09
吹水佬
Rank: 20Rank: 20Rank: 20Rank: 20Rank: 20
等 级:版主
威 望:432
帖 子:10064
专家分:41463
注 册:2014-5-20
得分:0 
float BMI(float height, float weight);
float BMI;
这两句同“名”
BMI=(height,weight); 这句想做什么?

#include<stdio.h>
float BMI(float height, float weight);

int main()
{
    float height;
    float weight;
    printf("请输入您的身高: \n");
    scanf("%f",&height);
    printf("请输入您的体重: ");
    scanf("%f",&weight);
    printf("您的BMI为:");
    printf("%f\n",BMI(height,weight));
    return 0;
}

float BMI(float height, float weight)
{
    float BMI =(weight*height);
    return BMI;
}
2018-09-01 05:24



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




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

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