指点下,哪里有问题
#include <stdio.h>#define AMT_SINGLE 17850
#define AMT_HOUSEHOLDER 23900
#define AMT_MARRY 29750
#define AMT_DIVORCE 14875
#define RATE1 0.15
#define RATE2 0.28
int main(void)
{
double salary,tax;
double amt;
int index;
int i;
printf("Which kind of tax payment you fitted,\nPlease input the number showed below (q to quit): \n");
printf("***************************************\n");
printf("1) Single 2)Householder\n");
printf("3) Married 4)Divorced\n");
printf("5) Quit\n");
printf("***************************************\n");
while(scanf("%d",&index) == 1)
{
switch (index)
{
case 1:amt = 17850;i = 1;break;
case 2:amt = 23900;i = 1;break;
case 3:amt = 29750;i = 1; break;
case 4:amt = 14875;i = 1; break;
case 5:i = 0;break;
default:printf("Please input the fallowing number(1~4): \n");i = scanf("%d",&index);break;
}
while (i)
{
printf("Next Type # to return previous level or input your Gross salary: ");
while ((i = scanf("%lf",&salary)) == 1 )
{
if (salary > 0)
tax = (salary > amt ? (salary - amt) * RATE2 + amt * RATE1:amt * RATE1);
else
printf("Wrong,type the positive number\n");
printf("Your gross salary %0.2lf\n",salary);
printf("Your tax: %.2lf\n",tax);
printf("Net income: %0.2lf\n",salary - tax);
printf("Type # to return previous level or salary :");
}
}
printf("***************************************\n");
printf("1) Single 2)Householder\n");
printf("3) Married 4)Divorced\n");
printf("5) Quit\n");
printf("***************************************\n");
printf("Which kind of tax payment you fitted,\nPlease input the number showed above (q to quit): \n");
}
return 0;
}