小问题 关于程序的运行顺序
小问题 关于程序的运行顺序想问问 是不是程序的运行都是从上到下一条条运行的啊?
还是它会先运行“{}”内的呢?
#include<stdio.h>
void main()
{float money,i,b;
int a;
printf("input the money:");
scanf("%f",&money);
if(money<1000)
printf("\n不收税\n");
else {a=(int)((money-1000)/500);
switch(a)
{case 0:
case 1:i=0.05f;break;
case 2:
case 3:
case 4:i=0.1f;break;
case 5:
case 6:
case 7:
case 8:
case 9:
case 10:i=0.15f;break;
case 11:
case 12:
case 13:
case 14:
case 15:
case 16:
case 17:
case 18:
case 19:
case 20:
case 21:
case 22:
case 23:
case 24:
case 25:
case 26:
case 27:
case 28:
case 29:
case 30:
case 31:
case 32:
case 33:
case 34:
case 35:
case 36:
case 37:
case 38:
case 39:
case 40:i=0.2f;break;
default:i=0.25f;
}
b=money*i;
printf("需要缴纳的税金为:%.1f元\n",b);
}
}