公司雇员信息管理系统

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

#include<stdio.h>#include<string.h>#include<stdlib.h>charpassword[10]="12345";//¶¨ÒåÈ«¾Ö±äÁ¿´æ´¢³õʼÃÜÂëintscan_login();//º¯ÊýÉùÃ÷intscan();intlogin();intchangepass();intindex_1();intindex_2();intLinkedListLength();typedefstructLNode//¹ÍÔ±Êý¾Ý½á¹¹ÃèÊö{doublenumber;charname[20];chardepartment[20];doubletime;doublepay;structLNode*next;}LNode,*LinkedList;LinkedListSelectSort2(LinkedListL)//ÅÅÐòº¯ÊýʵÏÖ{LinkedListp,q,small;doubletemp,i,j;charcop[20];for(p=L->next;p->next!=NULL;p=p->next){small=p;for(q=p->next;q;q=q->next){i=(q->time)*(q->pay);j=(small->time)*(small->pay);if(i<j){small=q;}}if(small!=p){temp=p->number;p->number=small->number;small->number=temp;temp=p->pay;p->pay=small->pay;small->pay=temp;temp=p->time;p->time=small->time;small->time=temp;strcpy(cop,p->name);strcpy(p->name,small->name);strcpy(small->name,cop);strcpy(cop,p->department);strcpy(p->department,small->department);strcpy(small->department,cop);}}returnL;}LinkedListLinkedListInit()//ÏßÐÔÁ´±í³õʼ»¯{LinkedListL;L=(LinkedList)malloc(sizeof(LNode));L->next=NULL;returnL;}voidLinkedListTraverse(LinkedListL)//µ¥Á´±íµÄ±éÀú{LinkedListp;p=L->next;printf("±àºÅ|ÐÕÃû|²¿ÃÅ|¹¤Ê±|ʱн\n");while(p!=NULL){printf("%-3.0f%s%s%-3.0f%-3.0f\n",p->number,p->name,p->department,p->time,p->pay);p=p->next;printf("\n");}}intLinkedListLength(LinkedListL)//ÇóÁ´±í³¤¶È{LinkedListp;intj;p=L->next;j=0;while(p!=NULL){j++;p=p->next;}returnj;}LinkedListLinkedListGet(LinkedListL,doublei)//²éѯ±àºÅΪiµÄ¹ÍÔ±ÐÅÏ¢{LinkedListp;doublej=1,k;k=LinkedListLength(L);p=L->next;while(p!=0&&(j<=k)){if(p->number==i)returnp;elsep=p->next;j++;}return0;}LinkedListLinkedListGet_name(LinkedListL,charname[20])//²éѯÐÕÃûΪnameµÄ¹ÍÔ±ÐÅÏ¢{LinkedListp;doublej=1,k;k=LinkedListLength(L);p=L->next;while(p!=0&&(j<=k)){if(strcmp(p->name,name)==0)returnp;elsep=p->next;j++;}return0;}intLinkedListDel(LinkedListL,doublenum)//¹ÍÔ±ÐÅϢɾ³ý{LinkedListpre,p;pre=L;p=L->next;while(p&&p->number!=num){pre=p;p=p->next;}if(p==NULL){printf("Êý¾Ý¿âÖÐûÓбàºÅΪ%lfµÄ¹ÍÔ±ÐÅÏ¢\n",num);return1;}pre->next=p->next;free(p);return0;}voidLinkedListInsert(LinkedListL,doublei,doublenumber,charname[20],chardepartment[20],doubletime,doublepay)//Êý¾ÝÔªËزåÈë{LinkedListpre,p,s;intj=1;pre=L;p=L->next;while(pre&&j<i){pre=p;p=p->next;j++;}if(pre==NULL){printf("¸øµÄiÖµ³¬¹ýÁË±í³¤");exit(0);}s=(LNode*)malloc(sizeof(LNode));s->number=number;strcpy(s->name,name);strcpy(s->department,department);s->time=time;s->pay=pay;pre->next=s;s->next=p;}LinkedListLinkedListCreat()//Ô±¹¤ÐÅÏ¢³õʼ»¯{LinkedListL=LinkedListInit(),p,r;r=L;doublenumber,time,pay;charname[20],department[20];printf("Çë°´ÕÕÒÔϸñʽÊäÈëÐÅÏ¢,ÊäÈë00000Í˳ö\n");printf("±àºÅ|ÐÕÃû|²¿ÃÅ|¹¤×÷ʱ¼ä|ʱн\n");scanf("%lf%s%s%lf%lf",&number,name,department,&time,&pay);while(number!=0){p=(LinkedList)malloc(sizeof(LNode));p->number=number;strcpy(p->name,name);strcpy(p->department,department);p->time=time;p->pay=pay;r->next=p;r=p;scanf("%lf%s%s%lf%lf",&number,name,department,&time,&pay);}r->next=NULL;returnL;}voidshow(){printf("***************************\n");printf("**\n");printf("*ÐÕÃû£ºÕÔ¿­Ç¿*\n");printf("*°à¼¶£ºÐÅÏ¢113*\n");printf("*ѧºÅ£º1108020324*\n");printf("*QQ£º419927089*\n");printf("**\n");printf("***************************\n");index_1();}intindex_1()//³ÌÐòÊ×Ò³Ãæ{switch(scan_login()){case1:login();break;case2:changepass();break;case3:show();break;case4:exit(-1);break;default:printf("ÇëÄú°´ÕÕÌáʾ²Ù×÷£¡\n");index_1();break;}return0;}intscan_login()//µÇ½½çÃæÏÔʾ{intd;printf("------------¹ÍÔ±ÐÅÏ¢¹ÜÀíϵͳ------------\n");printf("1.µÇ½\n2.ÐÞ¸ÄÃÜÂë\n3.°æ±¾ÐÅÏ¢\n4.Í˳ö\n");printf("----------------------------------------\n");scanf("%d",&d);return(d);}intscan()//ϵͳÖ÷½çÃæÏÔʾ{intd;printf("------------¹ÍÔ±ÐÅÏ¢¹ÜÀíϵͳ------------\n");printf("1.¹ÍÔ±ÐÅÏ¢³õʼ»¯\n");printf("2.¹ÍÔ±ÐÅÏ¢²éѯ\n");printf("3.¹ÍÔ±ÐÅÏ¢Ôö¼Ó\n");printf("4.¹ÍÔ±ÐÅϢɾ³ý\n");printf("5.¹ÍÔ±ÐÅÏ¢ÐÞ¸Ä\n");printf("6.¹ÍÔ±¹¤×ÊÅÅÐò\n");printf("7.ÏÔʾËùÓÐÐÅÏ¢\n");printf("0.Í˳öϵͳ\n");printf("----------------------------------------\n");scanf("%d",&d);return(d);}intlogin()//µÇ½º¯Êý{charpass[10];printf("ÇëÄúÊäÈëµÇ½ÃÜÂë(×î¶à10λ)£º");scanf("%10s",pass);while(strcmp(pass,password)!=0){printf("¶Ô²»Æð£¬ÄúÊäÈëµÄÃÜÂëÓÐÎó£¬ÇëÖØÐÂÊäÈ룡\n");printf("»òÕßÊäÈë¡°0¡±Í˳öµÇ¼ϵͳ£¡\n");scanf("%10s",pass);if(strcmp(pass,"0")==0)exit(-1);}printf("»¶Ó­Äú³É¹¦½øÈëϵͳ£¡\n&

1 / 10
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功