




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
--#-源程序#include"stdio.h"#defineN100#include"string.h"structworker{intnum;charname[20];intjibengongzi;intzhiwugongzi;intjintie;intyiliaobaoxian;intgongjijin;intqiansan;intsum;}worker[N];voidmenu();voidInput();voidModify();voidSearch();voidAdd();voidDelete();voidShow();voidExit();intmain(){system("cls");menu();}voidmenu(){intn;system("cls");printf("\n\n\n");printf("\t\t***********************************************\n");printf("\t\t****\n");printf("\t\t**Ifyouwerethefirsttoenterthesystem**\n");printf("\t\t**pleaseselectInput!**\n");printf("\t\t****\n");printf("\t\t**1 Input**\n");printf("\t\t**2 Modify**\n");
printf("\t\t** 3 Search **\n");printf("\t\t** 4 Add **\n");printf("\t\t** 5 Delete **\n");printf("\t\t** 6 Show **\n");printf("\t\t** 7 Exit **\n");printf("\t\t** **\n");printf("\t\t***********************************************\n");printf("\t\t***********************************************\n");printf("\t\t\n");printf("\n\n");printf("\t\tInputyourchoose(1-7):");scanf("%d",&n);if(n>=1&&n<=7){switch(n){case1:Input();break;case2:Modify();break;case3:Search();break;case4:Add();break;case5:Delete();break;case6:Show();break;case7:Exit();break;}}elsemenu();}voidInput(){inti,p;clrscr();printf("\n\nHowmanypeople?(0-100):");scanf("%d",&p);if(p>=0&&p<=N){printf("\n\n");printf("Pleaseinputdata:\n");printf("\n");printf("numnamejibengongzizhiwugongzijintieyiliaobaoxiangongjijin\n\n");for(i=0;i<p;i++){input(i);worker[i].sum=worker[i].jibengongzi+worker[i].zhiwugongzi+worker[i].jintie-worker[i].yiliaobaoxian-worker[i].gongjijin;worker[i].qiansan=worker[i].jibengongzi+worker[i].zhiwugongzi+worker[i].jintie;}}elseInput();save(p);select();}voidModify(){inti,j=-1,d,k,t,n;charm[20];FILE*fp;system("cls");n=P();printf("\n\n");printf("Choosethewayyouwanttomodify:\n");printf("\n\n");printf("\t\t****************************************\n");printf("\t\t**\n");printf("\t\t* 1.Bynametomodify*\n");printf("\t\t**\n");printf("\t\t* 2.Bynumbertomodify*\n");printf("\t\t**\n");printf("\t\t****************************************\n");printf("\ninputyourselection:");scanf("%d",&d);if(d!=1&&d!=2){printf("\ninputerror!Pressanykeytocontinue.");getchar();Modify();}elseif(d==1){doprintf("\nPleaseinputthename:");scanf("%s",m);for(i=0;i<n;i++)if(strcmp(m,worker[i].name)==0)j=i;if(j==-1)printf("\nNotfind!Pleaseinputagain!\n");}while(j==-1);}else{doprintf("\nPleaseinputthenum:");scanf("%d",&k);for(i=0;i<n;i++)if(k==worker[i].num)j=i;if(j==-1)printf("\nNotfind!Pleaseagain!\n");}while(j==-1);}printf("\nWhatdoyouwanttomodify?\n\n");printf("\t\t**************************************\n");printf("\t\t**\n")printf("\t\t*1.name2.number*\n")printf("\t\t**\n");printf("\t\t*3.jibengongzi4.zhiwugongzi*\n");printf("\t\t**\n");printf("\t\t*5.jintie6.yiliaobaoxian*\n");printf("\t\t**\n");printf("\t\t*7.gongjijin*\n");printf("\t\t**\n");printf("\t\t**************************************\n");printf("\nPleaseinputyourselection:");scanf("%d",&t);switch(t){case1:printf("\nbeforemodify:%s",worker[j].name);printf("\nchangeto:");scanf("%s",worker[j].name);printf("\naftermodify:%s",worker[j].name);break;case2:printf("\nbeforemodify:%d",worker[j].num);printf("\nchangeto:");scanf("%d",&worker[j].num);printf("\naftermodify:%d",worker[j].num);break;case3:printf("\nbeforemodify:%d",worker[j].jibengongzi);printf("\nchangeto:");scanf("%d",&worker[j].jibengongzi);printf("\naftermodify:%d",worker[j].jibengongzi);break;case4:printf("\nbeforemodify:%d",worker[j].zhiwugongzi);printf("\nchangeto:");scanf("%d",&worker[j].zhiwugongzi);printf("\naftermodify:%d",worker[j].zhiwugongzi);break;case5:printf("\nbeforemodify:%d",worker[j].jintie);printf("\nchangeto:");scanf("%d",&worker[j].jintie);printf("\naftermodify:%d",worker[j].jintie);break;case6:printf("\nbeforemodify:%d",worker[j].yiliaobaoxian);printf("\nchangeto:");scanf("%d",&worker[j].yiliaobaoxian);printf("\naftermodify:%d",worker[j].yiliaobaoxian);break;case7:printf("\nbeforemodify:%d",worker[j].gongjijin);printf("\nchangeto:");scanf("%d",&worker[j].gongjijin);printf("\naftermodify:%d",worker[j].gongjijin);break;default:printf("Error!choiceagain!!\n");break;}getchar();printf("\n");printf("numnamejibengongzizhiwugongzijintieyiliaobaoxiangongjijin
sum\n\n");worker[j].sum=worker[j].jibengongzi+worker[j].zhiwugongzi+worker[j].jintie-worker[j].yiliaobaoxian-worker[j].gongjijin;output(j);printf("\nSaveit?\n\n1.Yes2.No\n");scanf("%d",&i);if(i==1)save(n);printf("\nPressanykeytoback!");getchar();menu();voidSearch(){inti,j=-1,k,d,n;charm[20];n=P();system("cls");printf("Choosethewayyouwanttosearch:\n");printf("\n\n");printf("\t\tprintf("\t\tprintf("\t\tprintf("\t\tprintf("\t\tprintf("\t\tprintf("\t\t,**************************************1.Bynametosearch2.Bynumbertosearch**\n");,****************************************\n");*\n");printf("\t\tprintf("\t\tprintf("\t\tprintf("\t\tprintf("\t\tprintf("\t\tprintf("\t\t,**************************************1.Bynametosearch2.Bynumbertosearch**\n");,****************************************\n");*\n");*\n");*\n");*\n");*\n");printf("\n\n");printf("Pleaseinputyourselection:");scanf("%d",&d);if(d==2){doprintf("\nPleaseinputthenumber:");scanf("%d",&k);for(i=0;i<n;i++){if(k==worker[i].num)j=i;if(j==-1)printf("Notfind!Pleaseinputagain!\n");}while(j==-1);printf("\n");printf("numnamejibengongzizhiwugongzijintieyiliaobaoxiangongjijinsum\n\n");output(j);}elseif(d==1){do{printf("\nPleaseinputthename:");scanf("%s",m);for(i=0;i<n;i++)if(strcmp(m,worker[i].name)==0)j=i;if(j==-1)printf("Notfind!Pleaseinputagain!\n");}while(j==-1);printf("\n");printf("numnamejibengongzizhiwugongzijintieyiliaobaoxiangongjijinsum\n\n");output(j);}if(d!=1&&d!=2){printf("\nInputerror!Pressanykeytocontinue.");getchar();Search();}select();}voidAdd(){inti,k,m,n;FILE*fp;system("cls");n=P();printf("\n\nHowmanypeopledoyouwanttoadd:");scanf("%d",&m);
k=m+n;if(k<=N){printf("\n\nPleaseinputtheirinformation:\n\n");printf("numnamejibengongzizhiwugongzijintieyiliaobaoxiangongjijin\n\n");for(i=n;i<k;i++){input(i);worker[i].sum=worker[i].jibengongzi+worker[i].zhiwugongzi+worker[i].jintie-worker[i].yiliaobaoxian-worker[i].gongjijin;}if((fp=fopen("D:\\zggz.txt","ab"))==NULL){printf("\nCannotopenfile.\n");getchar();menu();}for(i=n;i<k;i++)if(fwrite(&worker[i],sizeof(structworker),1,fp)!=1)printf("filewriteerror.\n");fclose(fp);select();}elseAdd();}voidDelete(){inti,j=-1,d,k,t,n;charm[20];FILE*fp;system("cls");n=P();fp=fopen("D:\\zggz.txt","rb");printf("\n\n");printf("Choosethewayyouwanttodelete:\n");printf("\n\n");printf("\t\tprintf("\t\tprintf("\t\t1.Bynametodelete*\n");*\n");printf("\t\tprintf("\t\tprintf("\t\t1.Bynametodelete*\n");*\n");printf("\t\tprintf("\t\tprintf("\t\tprintf("\t\t2.Bynumbertodelete****************************************\n");printf("\ninputyourselection:");scanf("%d",&d);if(d!=1&&d!=2){printf("\ninputerror!Pressanykeytocontinue.");getchar();Delete();}elseif(d==1){do{printf("\nPleaseinputthename:");scanf("%s",m);for(i=0;i<n;i++)if(strcmp(m,worker[i].name)==0)j=i;if(j==-1)printf("\nNotfind!Pleaseagain!\n");}while(j==-1);}else{do{printf("\nPleaseinputthenum:");scanf("%d",&k);for(i=0;i<n;i++)if(k==worker[i].num)j=i;if(j==-1)printf("\nNotfind!Pleaseagain!\n");*\n")*\n")*\n")}while(j==-1);}printf("\n");printf("numnamejibengongzizhiwugongzijintieyiliaobaoxiansum\n\n");for(i=j;i<n-1;i++)gongjijinworker[i]=worker[i+1];for(i=0;i<n-1;i++)output(i);printf("Saveit?\n\n1.Yes2.No\n");scanf("%d",&i);if(i==1)save(n-1);printf("\nPressanykeytoback!");getchar();menu();voidShow(){inti,p,a=0,b=0,c=0,j=0,k=0,l=0,m=0,n=0;p=P();system("cls");printf("numnamejibengongzizhiwugongzijintieyiliaobaoxiangongjijinsum\n\n");for(i=0;i<p;i++)output(i);printf("\nnaveragesalary:\n");for(i=0;i<p;i++){j+=worker[i].jibengongzi;k+=worker[i].zhiwugongzi;l+=worker[i].jintie;m+=worker[i].yiliaobaoxian;n+=worker[i].gongjijin;}printf("%13d%11d%12d%7d%15d",j/p,k/p,l/p,m/p,n/p);printf("\n(qiansanxiang)renshubaifenbi\n");for(i=0;i<p;i++){if(worker[i].qiansan>3000)a++;elseif(worker[i].qiansan>=2000&&worker[i].qiansan<=3000)b++;elseif(worker[i].qiansan>=1000&&worker[i].qiansan<=2000)c++;}printf(" over3000:%-7d%6d%%\n",a,(a*100/p));printf(" 2000~3000:%-7d%6d%%\n",b,(b*100/p));printf(" 1000~2000:%-7d%6d%%\n",c,(c*100/p));
printf("\n");printf("Pressanykeytoback.");getchar();menu();}voidExit(){inti,p,a=0,b=0,c=0,j=0,k=0,l=0,m=0,n=0;p=P();system("cls");printf("numnamejibengongzizhiwugongzijintieyiliaobaoxiangongjijinsum\n\n");for(i=0;i<p;i++)output(i);printf("\nnaveragesalary:\n");for(i=0;i<p;i++){j+=worker[i].jibengongzi;k+=worker[i].zhiwugongzi;l+=worker[i].jintie;m+=worker[i].yiliaobaoxian;n+=worker[i].gongjijin;}printf("%13d%11d%12d%7d%15d",j/p,k/p,l/p,m/p,n/p);printf("\n(qiansanxiang)renshubaifenbi\n");for(i=0;i<p;i++){if(worker[i].qiansan>3000)a++;elseif(worker[i].qiansan>=2000&&worker[i].qiansan<=3000)b++;elseif(worker[i].qiansan>=1000&&worker[i].qiansan<=2000)}printf("printf("printf("printf("\n");getchar();system("cls");}printf("printf("printf("printf("\n");getchar();system("cls");over3000:%-7d%6d%%\n",a,(a*100/p));2000~3000:%-7d%6d%%\n",b,(b*100/p));1000~2000:%-7d%6d%%\n",c,(c*100/p));printf("\n\n\n\n\n\n\n\n");printf("\t***********************************************************\n");
printf("\t** **\n");printf("\t**Thankyoufortheuseofstaffwagemanagementsystem!**\n");printf("\t ** **\n");printf("\t ** **\n");printf("\t** Good-bye! **\n");printf("\t ** **\n");printf("\t***********************************************************\n");printf("\t***************************************
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 上进联考2025-2026学年新高三上学期秋季入学考试政治试卷
- GB∕T 35770-2022《 合规管理体系 要求及使用指南》之2:“4组织环境-4.1理解组织及其环境”专业深度解读和应用指导材料(2024C0)(可编辑!)
- 2026届山西省吕梁育星中学化学高三第一学期期末预测试题含解析
- 现代物流基本知识培训课件
- 现代家庭普法课件
- 2026届福建省仙游县郊尾中学高三上化学期中质量跟踪监视模拟试题含解析
- 2025年公务员行测地理国情专项训练试卷 地理常识冲刺押题
- 四川省资阳市2026届高一化学第一学期期中达标检测试题含解析
- 2025年考研英语(一)阅读理解长篇阅读策略试卷 实战演练
- 民法典小明一生课件
- 橡皮障隔离术知情同意书
- 临床医学内科学-消化系统疾病-肠结核和结核性腹膜炎
- 营区物业服务投标方案(技术标)
- 小学语文人教版一年级上册《我上学了单元整备课》word版教案
- 小学生小古文100篇
- 喷淋塔改造施工方案
- 高效能人士七个习惯
- 血浆置换在危重病人中的应用教学课件
- 六年级上册科学全册练习题(2022年新教科版)
- 沉井下沉纠偏措施
- 教师专业发展与名师成长(学校师范专业公共课)
评论
0/150
提交评论