刚刚学完do while试着研究别人的代码,找了一上午的错都没找到只能求助了
#include <stdio.h>#define A 8.75
#define B 9.33
#define C 10.00
#define D 11.20
#define tax_1 0.15
#define tax_2 0.20
#define tax_3 0.25
double main(void)
{
printf("*************************************************************************\n");
printf("Enter the number corresponding to the desired pay rate or action:\n");
printf("1) $8.75/hr 2) $9.33/hr\n");
printf("3) $10.00/hr 4) $11.20/hr\n");
printf("5) quit\n");
printf("*************************************************************************\n");
char chr;
double time;
double pay1,pay2;
while( (chr=getchar())!='5' )
{
printf("chr111=%c\n",chr);
switch(chr)
{
case '1':
printf("请输入工作时间:");
scanf("%lf",&time);
if(time<=40.0)
pay1=time*A;
else
pay1=(40.0+(time-40.0)*1.5)*A;
if(pay1>450.0)
pay2=pay1-(300.0*tax_1+150.0*tax_2+(pay1-450.0)*tax_3);
else
{
if(pay1<=450.0 && pay1>300.0)
pay2=pay1-(300.0*tax_1+(pay1-300)*tax_2);
else
pay2=pay1-pay1*tax_1;
}
printf("您的税后工资为:%lf\n",pay2);break;
case '2':
printf("请输入工作时间");
scanf("%lf",&time);
if(time<=40.0)
pay1=time*B;
else
pay1=(40.0+(time-40.0)*1.5)*B;
if(pay1>450.0)
pay2=pay1-(300.0*tax_1+150.0*tax_2+(pay1-450.0)*tax_3);
else
{
if(pay1<=450.0 && pay1>300.0)
pay2=pay1-(300.0*tax_1+(pay1-300)*tax_2);
else
pay2=pay1-pay1*tax_1;
}
printf("您的税后工资为:%lf\n",pay2);break;
case '3':
printf("请输入工作时间");
scanf("%lf",&time);
if(time<=40.0)
pay1=time*C;
else
pay1=(40.0+(time-40.0)*1.5)*C;
if(pay1>450.0)
pay2=pay1-(300.0*tax_1+150.0*tax_2+(pay1-450.0)*tax_3);
else
{
if(pay1<=450.0 && pay1>300.0)
pay2=pay1-(300.0*tax_1+(pay1-300)*tax_2);
else
pay2=pay1-pay1*tax_1;
}
printf("您的税后工资为:%lf\n",pay2);break;
case '4':
printf("请输入工作时间:");
scanf("%lf",&time);
if(time<=40.0)
pay1=time*D;
else
pay1=(40.0+(time-40.0)*1.5)*D;
if(pay1>450.0)
pay2=pay1-(300.0*tax_1+150.0*tax_2+(pay1-450.0)*tax_3);
else
{
if(pay1<=450.0 && pay1>300.0)
pay2=pay1-(300.0*tax_1+(pay1-300)*tax_2);
else
pay2=pay1-pay1*tax_1;
}
printf("您的税后工资为:%lf\n",pay2);break;
default:printf("您的输入有误!\n");
}
printf("*************************************************************************\n");
printf("Enter the number corresponding to the desired pay rate or action:\n");
printf("1) $8.75/hr 2) $9.33/hr\n");
printf("3) $10.00/hr 4) $11.20/hr\n");
printf("5) quit\n");
printf("*************************************************************************\n");
printf("chr222=%c\n",chr);
}
}
该有的东西都有了咋就是找不出错误呢