#include <stdio.h>
#include <conio.h> //在TC下这个可以不包含
main()
{
int hour = 0;
printf("你一周上了多少小时班?\n");
scanf("%d", &hour);
printf("是否加班?y=是, n=否\n");
char sel = getch();
float total = 0.f;
switch(sel)
{
case 'y':
total = float(hour) * 10.f + 15.f;
break;
case 'n':
total = float(hour) * 10.f;
break;
default:
printf("出错啦~~\n");
return;
}
float tariff = 0;
if(total <= 300.f) tariff = total * 0.1f;
else if(total > 300.f && total <=1000.f) tariff = total * 0.15f;
else tariff = total * 0.25;
printf("税前纯工资: %.2f, 应缴%.2f元税, 税后工资 %.2f\n", total, tariff, total - tariff);
}




让我们为生者祝福,为死者祈祷!
[
本帖最后由 flyue 于 2008-5-18 19:41 编辑 ]