| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 606 人关注过本帖
标题:怎么修改呢
取消只看楼主 加入收藏
aa985754755
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2018-4-11
结帖率:0
收藏
已结贴  问题点数:20 回复次数:0 
怎么修改呢
#include<stdio.h>
void main()
{
    float faHeight,moHeight,T;
    char sex,sports,diet;
    printf("父亲身高:");
    scanf("%f",&faHeight);
    printf("母亲身高:");
    scanf("%f",&moHeight);
    printf("性别(M/F):");
    scanf("%*c%c",&sex);
    printf("是否喜欢运动(Y/N):");
    scanf("%*c%c",&sports);
    printf("饮食是否良好(Y/N):");
    scanf("%*c%c",&diet);

   if(sex=='M')

        {if(sports=='Y')
         T=(faHeight+moHeight)*0.54*1.02;
            {if(diet=='Y')
             T=(faHeight+moHeight)*0.54*1.02*1.015;
            else
             T=(faHeight+moHeight)*0.54*1.02;}
         }else
        {if(diet=='Y')
         T=(faHeight+moHeight)*0.54*1.015;
        else
            T=(faHeight+moHeight)*0.54;}
   else
        {if(sports=='Y')
         T=(faHeight*0.923+moHeight)/2*1.02;
           {if(diet=='Y')
            T=(faHeight*0.923+moHeight)/2*1.02*1.015;
           else
            T=(faHeight*0.923+moHeight)/2*1.02;}
        else}
           {if(diet=='Y')
            T=(faHeight*0.923+moHeight)/2*1.015;
           else
            T=(faHeight*0.923+moHeight)/2;}
}
搜索更多相关主题的帖子: 修改 printf scanf 是否 if 
2018-04-11 18:22
快速回复:怎么修改呢
数据加载中...
 
   



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

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