下载本文档
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、用心整理可以编辑的word文档#include<> #include<>#define N 10000/*员工的最大数*/ typedef struct wagefloat wage1;/*员工的基本工资*/float Bonus;/*员工的奖金*/float tax;/*员工的税金*/float S_fee;/*员工的水费*/float D_fee;/*员工的电费*/float T_fee;/*员工的有线电视费 */float Q_fee;/*员工的清洁费*/float S_wage;/*员工的实发工资*/WAGE;typedef struct workerchar
2、name10;/*员工的姓名 */char ID10;/*员工的工号*/int ID_P;/*员工的职务代号1-高级工程师2-中级工程师3-初级工程师*/char ID_Wage10;/*员工的工资卡号*/char depart10;/*员工的部门 */int age;/*员工的年龄*/char sex;/*员工的性别*/char m_phone10;/* 员工的手机 */char H_phone10;/*员工的住宅电话*/WAGE salary;WORK;WORK woN;int n;/*员工的总数*/void menu();/*员工管理操作主菜单函数声明*/void menu1();/*员
3、工管理操作子菜单函数声明*/*Author : GTCopyRight : tgaofunction name : saveComments :保存文件函数input: 无output: 无CreatedDate : 2007/06/01*/save()/*保存函数,保存n个记录*/int w=1;FILE *fp;int i;system( "cls");if(fp=fopen("","wb")=NULL)/*以输出打开方式,在此前的记录被覆盖 */printf("nCannot open filen");ret
4、urn NULL;for(i=0;i<n;i+)if(fWrite(&woi,sizeof(struct worker),1,fp)!=1) printf("file write errorn");w=0;if(w=1)printf("file save ok!n");fclose(fp);getch();menu();/*Author : GTCopyRight : tgao function name : loadComments :载入文件函数input: 无output: 无CreatedDate : 2007/06/01*/loa
5、d()/*加载记录或可以计算记录个数的函数*/FILE *fp;int i,w;w=1;system( "cls");if(fp=fopen("","rb")=NULL) /*以输出打开方式,在此前的记录被覆盖*/printf("nCannot open filen");w=0;return NULL;n=0;for(i=0;!feof(fp);i+)fread(&woi,sizeof(struct worker),1,fp);n+;n=n-1;fclose(fp);if(w=1)printf("
6、Load file ok!");getch();menu();return(i-1);/*返回记录个数*/*Author : GTgCopyRight : tgaofunction name : no_inputComments :输入不能重复的员工编号input: i:表示第i个的员工编号信息n:表示比较到第n个员工编号信息output: 无CreatedDate : 2007/06/01*/void no_input(int i,int n)int j,k,w1;do/*i表示第i个的员工编号信息,n表示比较到第n个员工编号*/w1=0;printf("NO.:&quo
7、t;);scanf("%s",woi.ID);for(j=0;woi.IDj!='0'j+)/*员工编号输入函数,作了严格规定*/if(woi.IDj<'0'|woi.IDj>'9')/*判断员工编号是否为数字*/puts("Input error! Only be made up of (0-9).Please reinput!n");w1=1;break;if(w1!=1)for(k=0;k<n;k+)/*比较到第n个员工编号*/*判断员工编号是否有雷同*/*排除第i个员工编号即你要修
8、改的*/if(k!=i&&strcmp(wok.IDj,woi.IDj)=0)puts("This record is exist. please reinput!n");w1=1;break;while(w1=1);/*Author : GTCopyRight:tgaofunctionname:taxComments:工资税金inputs:表示员工工资信息output员工的税金CreatedDate:2007/06/01*/ float tax(float s) float tax;if(s<=800)tax=0;else if(s>800&a
9、mp;&s<=1400)tax=(s-800)*;else if(s>1400)tax=(s-1400)*+600*;return tax;/*Author : GTCopyRight : tgaofunction name : inputComments :输入一条员工记录input: i:表示第i个的员工信息output: 无CreatedDate : 2007/06/01*/void input(int i)/*输入一个记录函数*/int j,sum;no_input(i,i);/*调用员工编号输入函数*/printf("name:");fflus
10、h(stdin);gets();printf("Bank ID:");fflush(stdin);gets(woi.ID_Wage);printf("grade");scanf("%d”,&woi.ID_P);printf("Department:");fflush(stdin);gets(woi.depart);printf("age:");scanf("%d",&woi.age);printf("sex:");fflush(std
11、in);scanf("%c",&woi.sex);printf("mobile phone");fflush(stdin);gets(woi.m_phone);printf("home phone");fflush(stdin);gets(woi.H_phone);printf("basic salary");scanf("%f",&woi.;woi.=tax(woi.;printf("Bonus:");scanf("%f",&wo
12、i.;printf("water fee:");scanf("%f",&woi.;printf("dian fee:");scanf("%f",&woi.;printf("QingJie fee:");scanf("%f",&woi.;printf("TV fee:");scanf("%f",&woi.;woi.=woi.+woi.i.i.i.i.i.;/*Author : GTCopyRight : t
13、gaofunction name : enterComments :输入员工管理系统信息记录input: 无output: 无CreatedDate : 2007/06/01*/void enter()/*输入模块*/int i;system( "cls");printf("How many record(0-%d)?:",N);scanf("%d",&n);/*要输入的记录个数*/printf("nEnter data nownn");for(i=0;i<n;i+)printf("nInp
14、ut %dth record.n",i+1);input(i);/*调用输入函数*/getch();menu();/*Author : GTCopyRight : tgaofunction name : printf_oneComments :输出一条员工信息记录input: i:表示第i个的员工信息output: 无CreatedDate : 2007/06/01*/void printf_one(int i)/* 显示一个记录的函数 */int j;printf("%11s%-6s%-6s %d %d %c % %s %s",woi.ID,,w
15、oi.ID_Wage,woi.ID_P,woi.age,woi.sex,woi.,woi.m_phone,woi.H_phone);/*Author : GTCopyRight : tgaofunction name : printf_one_sComments :输出一条员工工资记录input: i:表示第i个的工资信息output: 无CreatedDate:2007/06/01用心整理可以编辑的word文档*void printf_one_s(int i)/* 显示一个记录的函数*/int j;printf(" %”,woi.,woi.,woi.,woi.,woi.,woi.,
16、woi.,woi.;/*Author : GTCopyRight : tgao function name : browseComments :输出员工管理系统信息记录input: 无output: 无CreatedDate : 2007/06/01 */ void browse()/*浏览(全部)模块*/ int i,j; system( "cls"); puts("n");printf("nt工号姓名银行卡号职称年龄 性别 实发工资 手机住宅电话n");for(i=0;i<n;i+) if(i!=0)&&(i
17、%10=0)/*目的是分屏显示 */g用心整理可以编辑的word文档printf("nnPass any key to contiune .");getch();puts("nn");printf_one(i);/*调用显示一个记录的函数 */printf("n");puts("n");printf("tThere are %d record.n",n);getch();/*按任意健*/menu(); /*Author : GTCopyRight : tgaofunction name : se
18、arch_by_IDComments :按工号查找所有员工信息记录input: 无output: 输出查找员工编号CreatedDate : 2007/06/01*/int search_by_ID()/*查找模块 */int i,k;struct worker s;k=-1;system( "cls");printf("nnEnter the ID:");scanf("%s",;/*输入要到达的地方*/for(i=0;i<n;i+)/*查找要修改的数据*/if(strcmp,woi.ID)=0)k=i;/*找到要修改的记录*/
19、printf("nt工号姓名银行卡号职称年龄 性别 实发工资手机住宅电话n");printf_one(k);printf("工资信息:n");printf("nt基本工资实发工资奖金 电费 清洁费 水费 电视费 税金n");printf_one_s(k);break;/*调用显示一个记录的函数*/if(k=-1)printf("nnNO exist!");getch();menu1();return -1;elsegetch();menu1();return k;/*Author : GTCopyRight : t
20、gaofunction name : search_by_ageComments :按年龄查找所有员工信息记录input: 无output: 输出查找员工编号CreatedDate : 2007/06/01*/int search_by_age()/*查找模块 */int i,k,t_age,b_age;struct worker s;k=-1;system( "cls");printf("nnEnter the top age:");scanf("%d",&t_age);printf("nnEnter the bo
21、ttom age:");scanf("%d",&b_age);printf("nt工号姓名银行卡号职称年龄 性别实发工资 手机住宅电话n");gfor(i=0;i<n;i+)/*查找要修改的数据*/if(woi.age>=b_age&&woi.age<=t_age)k=i;/*找到要修改的记录*/printf_one(k);*/break;/*调用显示一个记录的函数if(k=-1)printf("nnNO exist!");getch();menu1();return -1;else
22、getch();menu1();return k;/*Author : GTCopyRight : tgaofunction name:search_by_PComments :按职称统计所有员工的工资信息input: 无output: 无CreatedDate : 2007/06/01*/void count_by_P()/*查找模块 */int i,k;float S_sal3=0,0,0,sal3=0,0,0,bon3=0,0,0,tax3=0,0,0;system( "cls");for(i=0;i<n;i+)/*查找要修改的数据*/if(woi.ID_P=1
23、)S_sal0=S_sal0+woi.;sal0=sal0+woi.;bon0=bon0+woi.;tax0=tax0+woi.;else if(woi.ID_P=2)S_sal1=S_sal1+woi.;sal1=sal1+woi.;bon1=bon1+woi.;tax1=tax1+woi.;else if(woi.ID_P=3)S_sal2=S_sal2+woi.;sal2=sal2+woi.;bon2=bon2+woi.;tax2=tax2+woi.;printf("n级别为高级工程师的工资统计为:n");printf("实发工资:%f,基本工资:%f,奖金
24、:%f,税金:%fn",S_sal0,sal0,bon0,tax0);printf("n级别为中级工程师的工资统计为:n");printf("实发工资:f,基本工资:f,奖金:f,税金:fn",S_sal1,sal1,bon1,tax1);printf("n级别为初级工程师的工资统计为:n");printf("实发工资:%f,基本工资:%f,奖金:%f,税金:%fn",S_sal2,sal2,bon2,tax2);printf("n公司所有人员的工资统计为:n");printf(&qu
25、ot;实发工资:%f,基本工资:%f,奖金:%f,税金:%fn",S_sal2,sal2,bon2,tax2);getch();menu1();/*Author : GTCopyRight : tgaofunction name : orderComments :按照实发工资的高低排序inputoutputCreatedDate:2007/06/01*/void order()/*排序模块(按平均成绩)*/int i,j,k;struct worker s;system( "cls");for(i=0;i<n-1;i+)/*选择法排序*/k=i;for(j=
26、i+1;j<n;j+)if(woj.>wok.k=j;s=woi;woi=wok;wo止s;printf("The ordered data is:n");browse();getch();menu1();/*Author : GTCopyRight : tgaofunction name : menulComments:员工管理操作的子菜单input: 无output: 无CreatedDate : 2007/06/01*/*void menu1()int n,w1;dosystem( "cls" );/* 清屏 */puts("
27、tttt 员工管理操作!nn");puts("tt*MENU*nn");puts("ttt by ID");puts("ttt by age");puts("ttt salary");puts("ttt by salary");puts("ttt to menu");puts("nntt*n");printf("Choice your number(1-5): bb");scanf("%d",&n);if(n<0|n>5)/*对选择的数字作判断*/w1=1;printf("your choice is not between 1 and 4,Please input again:");getchar();else w1=0; while(w1=1);/*选择功能*/switch(n)case 1:search_by_ID();break;/*输入模块*/case 2:search_by_age();break;/*浏览模块*/case 3:count_by_P();break;/*查找模块*/case 4:order();break;/*浏览模块*/c
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2026上半年四川成都职业技术学院编制外(考试)招聘30人备考题库及一套答案详解
- 2025-2026学年海外汉语教学设计
- 2025-2026学年认识圆苏教版教学设计
- 2025-2026学年个案分析大班教案
- 2024-2025年高中化学 专题3 第1单元 金属键 金属晶体教学设计 苏教版选修3
- 2 自主数学建模的开题交流教学设计北师大版2019必修第二册-北师大版2019
- 第十四课 勇敢说“不”教学设计初中心理健康北师大版河南专版八年级全一册-北师大版河南专版
- 2024-2025学年新教材高中政治 第2单元 世界多极化 第5课 第1框 中国外交政策的形成与发展教学设计 新人教版选择性必修1
- 第2课 方法探秘教学设计初中艺术·美术冀美版2024七年级上册-冀美版2024
- 2025-2026学年水粉苹果基础教案
- 2026年四川省南充市辅警人员招聘考试试题解析及答案
- 博物馆意识形态责任制度
- (一模)南昌市2026届高三年级三月测试语文试卷(含答案解析)
- 错混料内部奖惩制度
- 华为采购内部管理制度
- 2026年吉林水利电力职业学院单招职业技能测试题库带答案详解(夺分金卷)
- 钢结构工厂安全规章制度
- 行政事业单位建设项目内部控制制度
- 【新教材】人教PEP版(2024)三年级下册英语全册教案
- 周围神经损伤康复治疗指南
- 全国计算机等级考试三级网络技术真题试题及答案
评论
0/150
提交评论