求解c语言答案
在一个工资管理系统中,工资项目包括编号、姓名、基本工资、奖金、支出、实发工资(=基本工资+奖金-支出)。输入10名工人除实发工资外的基本信息,求每名工人的实发工资,输出所...
在一个工资管理系统中,工资项目包括编号、姓名、基本工资、奖金、支出、实发工资(=基本工资+奖金-支出)。输入10名工人除实发工资外的基本信息,求每名工人的实发工资,输出所有人的全部信息,以及实发工资最高的工人姓名与实发工资。
展开
3个回答
展开全部
typedef struct WageInfo
{
unsigned int PersonnelNO;
char PersonnelName[20];
unsigned int BasicWage;
unsigned int Bonus;
unsigned int pay;
unsigned int RealWages;
}WageInfo_t;
void main(void)
{
WageInfo_t PersonnelInfo[10];
int i;
unsigned int MaxWages = 0;
for(i = 0; i < 10; i++)
{
printf("please input PersonnelNO\n");
scanf("%d",&PersonnelInfo[i].PersonnelNO);
printf("please input PersonnelName\n");
gets(PersonnelInfo[i].PersonnelName);
printf("please input BasicWage\n");
scanf("%d",&PersonnelInfo[i].BasicWage);
printf("please input Bonus\n");
scanf("%d",&PersonnelInfo[i].Bonus);
printf("please input pay\n");
scanf("%d",&PersonnelInfo[i].pay);
PersonnelInfo[i].RealWages = PersonnelInfo[i].BasicWage + PersonnelInfo[i].Bonus -PersonnelInfo[i].pay;
}
for(i = 0; i < 10; i++)
{
printf("Personnename:%s PersonnelNO:%d BasicWage:%d Bonus:%d pay:%d RealWages:%d\n",PersonnelInfo[i].PersonnelName,PersonnelInfo[i].PersonnelNO,PersonnelInfo[i].BasicWage,PersonnelInfo[i].Bonus,PersonnelInfo[i].pay,PersonnelInfo[i].RealWages);
if (MaxWages < PersonnelInfo[i].RealWages)
MaxWages = PersonnelInfo[i].RealWages;
}
for(i = 0; i < 10; i++)
{
if (MaxWages == PersonnelInfo[i].RealWages)
printf("the MaxWagesv Personnename:%s RealWages:%s\n",PersonnelInfo[i].PersonnelName, MaxWages);
}
return;
}
{
unsigned int PersonnelNO;
char PersonnelName[20];
unsigned int BasicWage;
unsigned int Bonus;
unsigned int pay;
unsigned int RealWages;
}WageInfo_t;
void main(void)
{
WageInfo_t PersonnelInfo[10];
int i;
unsigned int MaxWages = 0;
for(i = 0; i < 10; i++)
{
printf("please input PersonnelNO\n");
scanf("%d",&PersonnelInfo[i].PersonnelNO);
printf("please input PersonnelName\n");
gets(PersonnelInfo[i].PersonnelName);
printf("please input BasicWage\n");
scanf("%d",&PersonnelInfo[i].BasicWage);
printf("please input Bonus\n");
scanf("%d",&PersonnelInfo[i].Bonus);
printf("please input pay\n");
scanf("%d",&PersonnelInfo[i].pay);
PersonnelInfo[i].RealWages = PersonnelInfo[i].BasicWage + PersonnelInfo[i].Bonus -PersonnelInfo[i].pay;
}
for(i = 0; i < 10; i++)
{
printf("Personnename:%s PersonnelNO:%d BasicWage:%d Bonus:%d pay:%d RealWages:%d\n",PersonnelInfo[i].PersonnelName,PersonnelInfo[i].PersonnelNO,PersonnelInfo[i].BasicWage,PersonnelInfo[i].Bonus,PersonnelInfo[i].pay,PersonnelInfo[i].RealWages);
if (MaxWages < PersonnelInfo[i].RealWages)
MaxWages = PersonnelInfo[i].RealWages;
}
for(i = 0; i < 10; i++)
{
if (MaxWages == PersonnelInfo[i].RealWages)
printf("the MaxWagesv Personnename:%s RealWages:%s\n",PersonnelInfo[i].PersonnelName, MaxWages);
}
return;
}
更多追问追答
追问
虽然没有验证
追答
验证 把这个#include 加上 忘记了
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询