高手帮看下下!!!
#include "stdio.h"#include "conio.h"
#include "math.h"
main()
{
int grade;
long profit;
int salary=500;
printf("input profit");
scanf("%ld",&profit);
grade=(profit-1)/1000;
switch(grade)
{
case 0:salary+=profit*0;break;
case 1:salary+=profit*0.10;break;
case 2:
case 3:
case 4:salary+=profit*0.15;break;
case 5:
case 6:
case 7:
case 8:
case 9:salary+=profit*0.20;break;
default:salary+=profit*0.25;
}
printf("salary is %.2d",salary);
getch();
}
输入3000时得949
#include "stdio.h"
#include "conio.h"
#include "math.h"
main()
{
int grade;
long profit;
float salary=500;
printf("input profit");
scanf("%ld",&profit);
grade=(profit-1)/1000;
switch(grade)
{
case 0:salary+=profit*0;break;
case 1:salary+=profit*0.10;break;
case 2:
case 3:
case 4:salary+=profit*0.15;break;
case 5:
case 6:
case 7:
case 8:
case 9:salary+=profit*0.20;break;
default:salary+=profit*0.25;
}
printf("salary is %.2f",salary);
getch();
}
输3000时得950.00
为什么???