李逵打老虎 发表于 2015-11-30 17:51:06

小白求助,这个程序有错吗,为什么编译不出

本帖最后由 康小泡 于 2015-12-1 18:13 编辑

#include <stdio.h>
void main()
{
       
        float p,w,s,f,d;
        printf("please input p,w,s");
        scanf("%f%f%f",p,w,s);
        if (s>250)
        {
                d=0;
        }
        else if(s<500)
               
        { d=2;}
       
        else if(s<1000)
        {
                d=5;
        }
        else if(s<2000)
        {
                d=8;
        }
        else if (s<3000)
        {
                d=10;
        }
        else
        {d=15 ;
        }
   f=p*w*s*(100-d)/100.0;
    printf("%f",f);





}

yundi 发表于 2015-11-30 19:57:29

scanf("%f%f%f",p,w,s);
这句错了,再仔细看看scanf函数参数:smile

隔壁村的严二狗 发表于 2015-11-30 22:31:08

没加&
页: [1]
查看完整版本: 小白求助,这个程序有错吗,为什么编译不出