void main()
{
double result
char a
FILE *data=fopen("61590_4.dat","at")
if(data==NULL)
data=fopen("61590_4.dat","wt")
if(data==NULL)
return
NEXT:
token[n]=getchar()
result=exp()
if(token[n]=='\n')
{
token[n]='\0'
printf("%s=%g\n",token,result)
fprintf(data,"%s=%g\n",token,result)
}
else error()
printf("按Y继续,按N结束\n")
while(true)
{
a = getch()
if (a == 'y')
{
system("cls")
goto NEXT
}
else if (a == 'n')
return
}
fclose(data)
}
/*工资计算程序*/#include
main()
{
float
originwage
/*应发工资*/
float
realwage
/*实发工资*/
float
tax
/*所缴税款*/
int
i,hour,amount,money
printf("请选择工资种类:\n1.计时工资\n2.计件工资\n3.固定月工资\n")
scanf("%d",&i)
switch(i)
{
case
1:{
scanf("%d",&hour)
printf("请输入单位时间的薪水(单位:元)\n")
scanf("%f",&money)
originwage=money*hour
}
break
case
2:{
printf("请输入生产产品数量(单位:件)\n")
scanf("%d",&amount)
printf("请输入生产一件产品的薪水(单位:元)\n")
scanf("%f",&money)
originwage=money*amount
}
break
case
3:
printf("请输入你的固定工资\n")
scanf("%f",&originwage)
break
default:printf("输入错误!\n")
return
0
}
if(originwage<0)
{
printf("数据错误!\n")
return
0
}
if(originwage<2000)
tax=0
else
if(originwage>2000&&originwage<=2500)
tax=(originwage-2000)*0.05
else
if(originwage>2500&&originwage<=4000)
tax=(originwage-2500)*0.1+500*0.05
else
tax=(originwage-4000)*0.15+1500*0.1+500*0.05
printf("应发工资:
%f\n",originwage)
printf("所缴税款:
%f\n",tax)
printf("实发工资:
%f\n",originwage-tax)
return
0
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)