c语言初学者
include <stdio.h>
int main()
{
float a,b;
a>=0;
scanf("%f",&a);
switch ((int)(a/1000))
{
case 0:
case 1:
case 2:b=a*0% printf("%.2f",b);break;
case 3:
case 4:b=(a-2999)*3% printf("%.2f",b);break;
case 5:
case 6:
case 7:b=(a-4999)*10%+(4999-2999)*3% printf("%.2f",b);break;
default:b=(a-8000)*15%+(7999-4999)*10%+(4999-2999)*3% printf("%.2f",b);
}
}
[Error] invalid operands of types 'float' and 'int' to binary 'operator%'
不知道错在哪