如何定义一个新函数,not a function
结果见附件 price not a function#include<stdio.h>
long double price(long double I)
{ long double rate1=0.1,rate2=0.075,rate3=0.035,rate4=0.03,rate5=0.015,rate6=0.01;
long double price;
if(I<=100000)
price=I*rate1;
else if(I<=200000)
price=100000*rate1+(I-100000)*rate2;
else if(I<=400000)
price=100000*rate1+100000*rate2+(I-200000)*rate3;
else if(I<=600000)
price=100000*rate1+100000*rate2+200000*rate3+(I-400000)*rate4;
else if(I<=1000000)
price=100000*rate1+100000*rate2+200000*rate3+200000*rate4+(I-600000)*rate5;
else
price=100000*rate1+100000*rate2+200000*rate3+200000*rate4+400000*rate5+(I-10000000)*rate6;
return price;
}
main()
{
double I,price;
printf("请输入利润数额__");
scanf("%lf",&I);
price(I);
printf("奖金=%lf\n",price);
}