- 分享
- 0
- 人气
- 0
- 主题
- 14
- 帖子
- 2007
- UID
- 96129
- 积分
- 1491
- 阅读权限
- 18
- 注册时间
- 2007-8-28
- 最后登录
- 2017-6-16
- 在线时间
- 3887 小时
|
是不是在case ‘C’ 出现问题?还是在case 'B'的算术中的variable不能存储之前的资料?因为只能出现最后一次的资料。
case 'b' :
case 'B' : printf("\n\n");
printf("Fill Your Descriptions in the following\n");
printf("=======================================");
printf("\n[S/N %d] Enter NRIC no.: ",a=a+1);
flushall();
scanf("%s", &icno[a]);
printf("[S/N %d] Enter Name: ", a);
flushall();
gets(name[a]);
printf("[S/N %d] Enter Date of Birth(DD-MM-YYYY): ", a);
flushall();
gets(DOB[a]);
printf("[S/N %d] Enter Sex(M/F): ", a);
flushall();
scanf("%c", &sex[a]);
printf("[S/N %d] Enter Total Income: $", a);
flushall();
scanf("%f", &total_income[a]);
printf("[S/N %d] Enter Total Relief: $", a);
flushall();
scanf("%f", &total_relief[a]);
printf("[S/N %d] Enter Total Rebate: $", a);
flushall();
scanf("%f", &total_rebate[a]);
printf("\n");
printf("**To compute and display your amount payment, please press C to continue.\n\n\n");
pre_payment[a] = total_income[a] - total_relief[a];
if(pre_payment[a]>=0 && pre_payment[a]<20000)
{
taxable_amount[a] = pre_payment[a] * 0;
}
else
{
if(pre_payment[a] > 20000 && pre_payment[a] <= 30000)
{
taxable_amount[a] = 0 + (pre_payment[a]-20000) * 0.035;
}
else
{
if(pre_payment[a] > 30000 && pre_payment[a] <= 40000)
{
taxable_amount[a] = 350 + (pre_payment[a]-30000) * 0.055;
}
else
{
if(pre_payment[a] > 40000 && pre_payment[a] <= 80000)
{
taxable_amount[a] = 900 + (pre_payment[a]-40000) * 0.085;
}
else
{
if(pre_payment[a] > 80000 && pre_payment[a] <= 160000)
{
taxable_amount[a] = 4300 + (pre_payment[a]-80000) * 0.14;
}
else
{
if(pre_payment[a] > 160000 && pre_payment[a] <= 320000)
{
taxable_amount[a] = 15500 + (pre_payment[a]-160000) * 0.17;
}
else
{
taxable_amount[a] = 42700 + (pre_payment[a]-320000) * 0.2;
}
}
}
}
}
}
amount_payment[a] = taxable_amount[a] - total_rebate[a];
break;
case 'c' :
case 'C' : printf("Enter Your NRIC: ");
flushall();
gets(icno_search);
if(strcmp(icno[a], icno_search) == 0)
{
printf("\n\nYour Total Amount Payment");
printf("\n=========================");
printf("\nNRIC\t\t\t : %s", icno[a]);
printf("\nName\t\t\t : %s", name[a]);
printf("\nDate of Brith\t\t : %s\n", DOB[a]);
printf("Sex\t\t\t : %c\n\n", sex[a]);
printf("Total income\t\t : $%9.2f\n", total_income[a]);
printf("\t\tLess relief: -$%9.2f\n", total_relief[a]);
printf("Total taxable amount\t : $%9.2f\n", taxable_amount[a]);
printf("\t\tLess rebate: -$%9.2f\n", total_rebate[a]);
printf("\n");
printf("Amount payment\t\t : $%9.2f\n", amount_payment[a]);
}
printf("\n");
printf("**If you don't use this Tax Advisor Program, please press D to QUIT.\n\n\n");
break;
[ 本帖最后由 无我不在 于 2009-1-11 05:58 PM 编辑 ] |
|