#include <stdio.h>
int main()
{
float a;
int b, c, d;
float val;
scanf("%f%d%d%d", &a, &b, &c, &d);
if (b == 11 && c == 11&&a*0.7-50*d>0)
{
val = a * 0.7 - 50 * d;
printf("%.2lf", val);
}
else if (b == 11 && c == 11 && a * 0.7 - 50 * d <= 0)
{
printf("%.2lf", 0.00);
}
else if(b==12&&c==12&&a*0.8-50*d>0)
{
val = a * 0.8 - 50 * d;
printf("%.2lf", val);
}
else
{
return 0.00;
}
return 0;
}
一个非常重要的事是当最后的价钱为负数时商家不可能倒贴你钱,只能return成为0
运行结果如下
标签:11,12,衣服,val,50,0.7,&& From: https://blog.csdn.net/sunjiazheng906/article/details/139197691