变量类型!
#include<stdio.h>#include<stdlib.h>
int main()
{
long int gain;
int prize1,prize2,prize4,prize6,prize10,prize=0.0;
printf("***********************************************\n");
printf("* The program will solve *\n");
printf(" the problem of prize distribution *\n");
printf("***********************************************\n");
printf("please input the num of gain:");
scanf("%ld",&gain);
prize1=100000*0.1;
prize2=prize1+100000*0.075;
prize4=prize2+200000*0.05;
prize6=prize4+200000*0.03;
prize10=prize6+400000*0.015;
if(gain<=100000)
prize=gain*0.1;
else if(gain<=200000)
prize=prize1+(gain-100000)*0.075;
else if(gain<=400000)
prize=prize2+(gain-200000)*0.05;
else if(gain<=600000)
prize=prize4+(gain-400000)*0.03;
else if(gain<=1000000)
prize=prize6+(gain-600000)*0.015;
else
prize=prize10+(gain-1000000)*0.01;
printf("The prize is:%d\n",prize);
return 0;
}将第六行int 改为double后结果出现错误,不管输入任何数,结果都为0!