标题:作业,帮看看哪错了。。。
取消只看楼主
ai_44
Rank: 1
等 级:新手上路
帖 子:17
专家分:0
注 册:2011-9-26
结帖率:66.67%
已结贴  问题点数:5 回复次数:2 
作业,帮看看哪错了。。。
程序代码:
#include <stdio.h>
int main1()
{
    double sex,high,weight,goodweight;
    printf("请输入您的性别,男=1,女=0,sex= \n");
    scanf("%d\n",&sex);
    printf("请输入您的身高(单位cm),high= \n");
    scanf("%f\n",&high);
    printf("请输入您的体重(单位KG),weight= \n");
    scanf("%f\n",&weight);

    if(sex)      { goodweight = (high-100)*0.9;}
     else         {goodweight = (high-100)*0.9-2.5;}    
    if((weight <= 0.6*goodweight))       
        printf("很遗憾,您已经脱离正常人范围了,请立即去救助站~!");   
    if((weight >= 0.6*goodweight))&&((weight <= 0.8*goodweight))      
        printf("您处于消瘦状态,请增重%dkg,多吃多锻炼",(int)(goodweight-weight+1));  
    if((weight >= 0.8*goodweight))&&((weight <= 0.9*goodweight))      
        printf("您处于偏瘦状态,请增重%dkg,适当锻炼身体",(int)(goodweight-weight+1));  
    if((weight >= 0.9*goodweight))&&((weight <= 1.1*goodweight))      
        printf("恭喜您,您的体重正常,请保持",);  
    if((weight >= 1.3*goodweight))&&((weight <= 1.5*goodweight))     
        printf("您处于偏胖状态,请减轻%dkg,多吃蔬菜少吃肉",(int)(weight-goodweight+1));   
    if((weight >= 1.5*goodweight))&&((weight <= 1.8*goodweight))    
        printf("您处于肥胖状态,请减轻%dkg,只吃蔬菜不吃肉",(int)(weight-goodweight+1));   
    if((weight >= 0.6*goodweight))     
        printf("我对您深表同情。。。");             
   
        getchar();       
        getchar();   
        return 0;
} 




错误    4    error C2143: 语法错误 : 缺少“;”(在“&&”的前面)  

警告    5    warning C4390: “;”: 找到空的受控语句;这是否是有意的?   
搜索更多相关主题的帖子: high 
2011-10-16 22:35
ai_44
Rank: 1
等 级:新手上路
帖 子:17
专家分:0
注 册:2011-9-26
得分:0 
程序代码:
#include <stdio.h>
int main()
{
    double sex,high,weight,goodweight;
    printf("请输入您的性别,男=1,女=0,sex= \n");
    scanf("%d\n",&sex);
    printf("请输入您的身高(单位cm),high= \n");
    scanf("%f\n",&high);
    printf("请输入您的体重(单位KG),weight= \n");
    scanf("%f\n",&weight);

    if(sex)
        {goodweight = (high-100)*0.9;}
   
    else
        {goodweight = (high-100)*0.9-2.5;}
    if(weight <= 0.6*goodweight)
        printf("很遗憾,请珍惜最后的时光~");
    else if((weight >= 0.6*goodweight)&&(weight <= 0.8*goodweight))
        printf("您处于消瘦状态,请增重%dkg,多吃多锻炼",(int)(goodweight-weight+1));
    else if((weight >= 0.8*goodweight)&&(weight <= 0.9*goodweight))
        printf("您处于偏瘦状态,请增重%dkg,适当锻炼身体",(int)(goodweight-weight+1));
    else if((weight >= 0.9*goodweight)&&(weight <= 1.1*goodweight))
        printf("恭喜您,您的体重正常,请保持",);
    else if((weight >= 1.3*goodweight)&&(weight <= 1.5*goodweight))
        printf("您处于偏胖状态,请减轻%dkg,多吃蔬菜少吃肉",(int)(weight-goodweight+1));
    else if((weight >= 1.5*goodweight)&&(weight <= 1.8*goodweight))
        printf("您处于肥胖状态,请减轻%dkg,只吃蔬菜不吃肉",(int)(weight-goodweight+1));
    else if(weight >= 1.8*goodweight)
        printf("我对您深表同情。。。");
     
        getchar();
        getchar();
        return 0;
}


还是不能运行。。
错误    4    error C2059: 语法错误 : “)”      12    work1
2011-10-16 22:53
ai_44
Rank: 1
等 级:新手上路
帖 子:17
专家分:0
注 册:2011-9-26
得分:0 
我真粗心。。。
2011-10-16 23:16



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




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

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