大侠们帮着看看,这个小程序运行为什么会这样?
#include "stdio.h"#include"stdlib.h"
int main(void)
{
double i;
double ticheng,t1,t2,t3,t4,t5;
t1=100000*0.1;
t2=t1+100000*0.075;
t3=t1+t2+200000*0.05;
t4=t1+t2+t3+200000*0.03;
t5=t1+t2+t3+t4+400000*0.015;
printf("Please input the total value:");
scanf("%lf\n",&i);
if(i<=100000)
{ticheng=i*0.1;}
else if(100000<i<=200000)
{ticheng=t1+(i-100000)*0.075;}
else if(200000<i<=400000)
{ticheng=t2+(i-200000)*0.05;}
else if(400000<i<=600000)
{ticheng=t3+(i-400000)*0.03;}
else if(600000<i<=1000000)
{ticheng=t4+(i-600000)*0.015;}
else if(i>1000000)
{ticheng=t5+(i-1000000)*0.01;}
printf("your ticheng is :%lf\n",ticheng);
system("PAUSE");
return 0;
}
运行的时候输入完数字按回车没用,不输出结果,只有输入一个字符再按回车才有结果,这是为什么呀?