#include"stdio.h"
void shuju_input()
{
printf("请输入p,w,s\n");
}
float shuju_jisuan(float w, float p,float s,int d)
{
float f;
f=p*w*s*(1-d/100);
return(f);
}
float jisuan_d(float s)
{
int d,c;
if(s>=3000) c=12;
else
c=(int)s/250;
switch(c)
{
case 0:d=0;break;
case 1:d=2;break;
case 2:
case 3:d=5;break;
case 4:
case 5:
case 6:
case 7:d=8;break;
case 8:
case 9:
case 10:
case 11:d=10;break;
case 12:d=15;break;
}
return(d);
}
int main()
{
float s,w,p,f;
int d;
shuju_input();
scanf("%f %f %f",&p,&w,&s);
d=jisuan_d(s);
printf("d=%d\n",&d);
f=shuju_jisuan(w, p,s,d);
printf("运费的优惠价为:%f\n",&f);
return 0;
}
我看d的输出结果很大! f也就是运费的值为0,能力不足,寻求各位帮助啊,心累
打印用地址打印吗???
printf("运费的优惠价为:%f\n",f);