scanf无法接收东西,不管输入什么都是0
#include<stdio.h>int main(){
double i=0;
double bonus1,bonus2,bonus4,bonus6,bonus10,bonus;
printf("请输入i\n");
scanf("%f",&i);
bonus1 = 100000*0.1;
bonus2=bonus1+100000*0.75;
bonus4 = bonus2+200000*0.5;
bonus6 = bonus4+200000*0.3;
bonus10 = bonus6+400000*0.15;
if(i<= 100000.0){
bonus = i*0.1;
}else if(i<200000.0){
bonus = bonus2+(i-100000)*0.075;
}else if(i<= 400000.0){
bonus = bonus2+(i-200000)*00.05;
}else if(i<600000.0){
bonus = bonus4+(i-400000)*0.03;
}else if(i<= 1000000.0){
bonus = bonus6+(i-600000)*0.015;
}else {
bonus = bonus10+(i-1000000)*0.01;
}
printf("%f\n",i);
printf("%f\n",bonus);
printf("%f\n",bonus1);
} double变量用 %lf
页:
[1]