《c语言_职工工资管理系统设计.doc》由会员分享,可在线阅读,更多相关《c语言_职工工资管理系统设计.doc(6页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。
1、题目3:职工工资管理系统设计功能:实现简单的职工工资信息管理,职工工资的基本信息包括编号、姓名、基本工资、奖金、工资总额等 基本要求:1设计简单的菜单,能够进行系统功能选择。 2实现信息的录入功能。3在已有信息的基础上添加新的记录。 4删除指定编号的记录。 5修改指定编号的记录 6实现信息的浏览功能 7按编号查询功能8按工资总额排序功能 #include stdio.h#include stdlib.h#include ctype.h#include process.hstruct gongzi /*定义数组*/ int bianhao; char xingming10; int jbgz;/
2、*基本工资*/ int jiangjin; int tatal; struct gongzi *next;void print() /*菜单*/ printf(welcom!n); printf(1.创建新信息n); printf(2.删除原信息n); printf(3.修改原信息n); printf(4.按编号查找n); printf(5.工资总额排序n);struct gongzi * creat(struct gongzi*head) /*case1创建工资,降序排列*/ struct gongzi *p1, *p2, *p3; /*p1新增点,p2,p3切点*/ p1 =p2 =p3
3、=(struct gongzi * )malloc(sizeof(struct gongzi) );printf(创建新信息n输入编号,姓名,基本工资,奖金n); printf(输入编号);scanf(%d,&p1-bianhao); printf(输入姓名);scanf(%s,&p1-xingming); printf(输入基本工资);scanf(%d,&p1-jbgz);printf(输入奖金);scanf(%d,&p1-jiangjin); p1-tatal =p1-jbgz + p1-jiangjin; p1-next =NULL; if(head = NULL) head =p1;
4、else p2 =head; while(p2-tatal tatal) & (p2-next !=NULL) p3 =p2; p2 =p2-next; if(p1-tatal tatal)if(head = p1)head =p1;elsep3-next =p1;p1-next =p2; elsep2-next =p1;p1-next =NULL; return head;struct gongzi * del(struct gongzi*head) /*case2删除原信息*/int bianhao;struct gongzi *p1, *p2;printf(输入要删除的编号);if(he
5、ad = NULL)printf(nlist is null);goto end;p1=head;scanf(%d,&bianhao);while(bianhao != p1-bianhao) & (p1-next != NULL)p2 =p1;p1 =p1-next;if(bianhao =p1-bianhao)if(p1 = head)head =p1-next;elsep2-next =p1-next;printf(%d has been deleted.n,bianhao);elseprintf(%d not been found!n,bianhao);end:return(head)
6、;struct gongzi * change(struct gongzi*head) /*case 3修改原信息*/int bianhao;struct gongzi *p1, *p2;printf(输入要修改的编号);if(head = NULL)printf(nlist is null);goto end;p1=head;scanf(%d,&bianhao);while(bianhao != p1-bianhao) & (p1-next != NULL)p2 =p1;p1 =p1-next;if(bianhao =p1-bianhao)printf(输入编号);scanf(%d,&p1-
7、bianhao);printf(输入姓名);scanf(%s,&p1-xingming);printf(输入基本工资);scanf(%d,&p1-jbgz);printf(输入奖金);scanf(%d,&p1-jiangjin);p1-tatal =p1-jbgz + p1-jiangjin;p1-next =NULL;printf(%d has been change.n,bianhao);elseprintf(%d not been found!n,bianhao);end:return(head);struct gongzi * search(struct gongzi*head) /*
8、case4按编号查找*/int bianhao;struct gongzi *p1, *p2;printf(输入要查找的编号);if(head = NULL)printf(nlist is null);goto end;p1=head;scanf(%d,&bianhao);while(bianhao != p1-bianhao) & (p1-next != NULL)p2 =p1;p1 =p1-next;if(bianhao =p1-bianhao)printf(%5d%10s%5d%5d%5dn,p1-bianhao, p1-xingming,p1-jbgz, p1-jiangjin, p1
9、-tatal);elseprintf(%d not been found!n,bianhao);end:return(head);void list(struct gongzi*head) /*case5输出*/struct gongzi*p1;p1 =head;printf(编号、姓名、基本工资、奖金、工资总额n);if(head = NULL)printf(nlist is nulln);while(p1 != NULL)printf(%5d%10s%5d%5d%5dn,p1-bianhao, p1-xingming,p1-jbgz, p1-jiangjin, p1-tatal);p1 =
10、p1-next;main() int caidan, ch;struct gongzi*p; struct gongzi*head =NULL;loop:print(); scanf(%d,&caidan); switch(caidan) case 1: head =creat(head);getch(); break;case 2:head =del(head);getch();break;case 3:head =change(head);getch();break;case 4:head =search(head);getch();break;case 5:list(head);getch();break; goto loop;