#include"stdio.h"
main()
{
double basis=0; //绩效工资
double post=0; //岗位工资
double Overtime=0; //加班工资
double piece=0; //计件工资
double allowance=0; //津贴工资
double Gross_wage=0; //总工资
double standards=800.0;
int a,c;
char b[10];
double days;
double Par;
printf("请输入员工的个人信息:\n");
scanf("%d",&a);
scanf("%s",b);
scanf("%d",&c);
printf("%d %s %d\n",a,b,c);
printf("请输入员工的考勤信息:\n");
scanf("%ld",&days);
printf("请输入员工的表现信息:\n");
scanf("%ld",&Par);
basis=300.0*Par;
{
int s,p;
printf("请输入员工的岗位信息1-4:\n");
scanf("%d",&p);
printf("请输入员工的岗位级别1-10:\n");
scanf("%d",&s);
if(p==1) post=500.0*s;
else if(p==2) post=300.0*s;
else if(p==3) post=150.0*s;
else if(p==4) post=100.0*s;
printf("岗位工资:%d\n",post);
}
Overtime=(standards/26.0)*days;
{
int j;
printf("请输入员工的计件信息:\n");
scanf("%ld",&j);
piece=piece+j; //计件工资
}
allowance=(100.0/26.0)*days; //津贴工资
Gross_wage=allowance+basis+post+Overtime+piece+standards;
printf("员工工资表:%ld %ld %ld %ld %ld\n",basis,Overtime,piece,piece,allowance);
printf("总工资:%ld\n",Gross_wage);
}
我猜 你要实现这个
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
double getPost(double post)
{
int s, p;
printf("请输入员工的岗位信息1-4:\n");
scanf("%d", &p);
printf("请输入员工的岗位级别1-10:\n");
scanf("%d", &s);
if (p == 1) post = 500.0 * s;
else if (p == 2) post = 300.0 * s;
else if (p == 3) post = 150.0 * s;
else if (p == 4) post = 100.0 * s;
printf("岗位工资:%lf\n", post);
return post;
}
double getPiece(double piece)
{
double j;
printf("请输入员工的计件信息:\n");
scanf("%lf", &j);
piece = piece + j; //计件工资
return piece;
}
int main()
{
double basis = 0; //绩效工资
double post =0 ; //岗位工资
double Overtime = 0; //加班工资
double piece = 0; //计件工资
double allowance = 0; //津贴工资
double Gross_wage = 0; //总工资
double standards = 800.0;
int a, c;
char b[10];
double days;
double Par;
printf("请输入员工的个人信息:\n");
scanf("%d%s%d", &a,b,&c);
printf("%d %s %d\n", a, b, c);
printf("请输入员工的考勤信息:\n");
scanf("%lf", &days);
printf("请输入员工的表现信息:\n");
scanf("%lf", &Par);
basis = 300.0 * Par;
post=getPost(post);
Overtime = (standards / 26.0) * days;
piece=getPiece(piece);
allowance = (100.0 / 26.0) * days; //津贴工资
Gross_wage = allowance + basis + post + Overtime + piece + standards;
printf("员工工资表:%lf %lf %lf %lf %lf\n", basis,post,Overtime, piece, allowance);
printf("总工资:%lf\n", Gross_wage);
return 0;
}
scanf语法不对,应该是%lf
%ld改成%lf吧,变量都是double