#includeiostream#includestring#includefstream#includestdlib.h#includestdio.h#defineN100//N×÷Ϊ×î´óÖ°¹¤×ÜÊýintf=0;//f×÷Ϊ¿ª¹Øusingnamespacestd;stringp;//½ÓÊܲ˵¥Ñ¡Ïîvoidmenu();//²Ëµ¥ÖÆ×÷classworker//Ö°¹¤»ù±¾ÐÅÏ¢Àà{public:worker(){}voidvisit();//Ö°¹¤ÐÅÏ¢ÏÔʾ~worker(){}friendclassWorkerList;//ÓÑÔªº¯Êýwotkerlistprivate:stringnum,name,sex,edu,address,tel;//¹¤ºÅÐÕÃûÐÔ±ðѧÀúµØÖ·µç»°intage,salary;//ÄêÁäÔÂн};classWorkerList//Ö°¹¤ÏµÍ³¹¦ÄÜʵÏÖÀà{private:workerw[N];//µÚN¸öÖ°¹¤intNUM;//ÓÃÀ´¼ÆËãÖ°¹¤ÊýÄ¿intcount;//ÓÃÀ´ÔÝʱ¼Ç¼µ±Ç°²Ù×÷µÚ¼¸¸öÖ°¹¤public:voidadd();//Ö°¹¤ÐÅϢ¼Èëvoidsort();//Ö°¹¤ÐÅÏ¢ÅÅÐòvoidsearch();//Ö°¹¤ÐÅÏ¢²éÕÒvoiddele();//Ö°¹¤ÐÅϢɾ³ývoidchange();//Ö°¹¤ÐÅÏ¢ÐÞ¸Ävoidsave();//Ö°¹¤ÐÅÏ¢ÒÔÎļþÐÎʽ±£´ævoidvisitworker();//ÏÔʾְ¹¤ÐÅÏ¢ÔÚÆÁÄ»ÉÏWorkerList(){NUM=0;count=0;//ĬÈϹ¹Ô캯Êý³õʼ»¯NUMºÍcount}};voidmenu()//ϵͳÖ÷²Ëµ¥{coutendl;coutendl;cout***********************************************endl;cout****endl;cout**Ö°¹¤ÐÅÏ¢¹ÜÀíϵͳÖ÷²Ëµ¥**endl;cout****endl;cout**1.Ö°¹¤ÐÅÏ¢Ìí¼Ó**endl;cout**2.Ö°¹¤ÐÅÏ¢ÐÞ¸Ä**endl;cout**3.Ö°¹¤ÐÅϢɾ³ý**endl;cout**4.Ö°¹¤ÐÅÏ¢ÅÅÐò**endl;cout**5.Ö°¹¤ÐÅÏ¢²éÕÒ**endl;cout**6.Ö°¹¤ÐÅÏ¢ÏÔʾ**endl;cout**7.Ö°¹¤ÐÅÏ¢±£´æ**endl;cout**0.Í˳ö**endl;cout****endl;cout***********************************************endl;coutendl;}//¸÷¸ö¹¦Äܺ¯Êý¶¨ÒåvoidWorkerList::add()//Ö°¹¤ÐÅÏ¢Ìí¼Óº¯ÊýʵÏÖ{coutÇëÊäÈëÖ°¹¤ÐÅÏ¢:endl;cout¹¤ºÅ\tÐÕÃû\tÐÔ±ð\tѧÀú\tÄêÁä\t¹¤×Ê\tµØÖ·\tµç»°endl;stringnum;cinnum;for(inti=0;iNUM;i++)while(num==w[i].num){cout´ËÖ°¹¤±àºÅÒÑ´æÔÚ£¬ÇëÖØÐÂÊäÈ룺endl;cinnum;}w[NUM].num=num;cinw[NUM].namew[NUM].sexw[NUM].eduw[NUM].agew[NUM].salaryw[NUM].addressw[NUM].tel;++NUM;count=NUM;}voidWorkerList::change()//Ö°¹¤ÐÅÏ¢Ð޸ĺ¯Êý¶¨Òå{if(NUM=0)//ÅжÏÊÇ·ñÓÐÖ°¹¤ÐÅÏ¢ÐèҪ¼Èë{coutûÓÐÖ°¹¤ÐÅÏ¢´æÈ룬ϵͳ½«·µ»ØÖ÷²Ëµ¥endl;menu();//ÎÞÐÅϢ¼È룬ÔٴνøÈëÖ÷²Ëµ¥}else{coutÖ°¹¤ÐÅÏ¢ÈçÏ£ºendl;cout¹¤ºÅ\tÐÕÃû\tÐÔ±ð\tѧÀú\tÄêÁä\t¹¤×Ê\tµØÖ·\tµç»°endl;for(inti=0;icount;i++)coutw[i].num'\t'w[i].name'\t'w[i].sex'\t'w[i].edu'\t'w[i].age'\t'w[i].salary'\t'w[i].address'\t'w[i].telendl;}//Êä³ö¸÷Ö°¹¤»ù±¾ÐÅÏ¢coutÇëÊäÈëÐèÒªÐÞ¸ÄÐÅÏ¢Ö°¹¤µÄ¹¤ºÅ£ºendl;stringnum1;cinnum1;//ÐèÒªÐÞ¸ÄÐÅÏ¢µÄÔ±¹¤¹¤ºÅintj=0,k;intflag=1;while(flag)//ÉèÖÿª¹Ø{for(;jcount;j++){if(num1==w[j].num){flag=0;k=j;break;}//ÕÒµ½¶ÔÓ¦¹¤ºÅµÄÔ±¹¤£¬½«flagÖÃ0}if(flag){cout²»´æÔÚ´ËÔ±¹¤£¬ÇëÖØÐÂÊäÈ룺endl;j=0;cinnum1;}//¾¹ýÑ»·½á¹¹Î¢ÕÒµ½¶ÔÓ¦Ô±¹¤ºÅÂ룬ÖØÐÂÊäÈënum1}coutÄãÑ¡ÔñµÄÖ°¹¤µÄÐÅϢΪ£ºendl;cout¹¤ºÅ\tÐÕÃû\tÐÔ±ð\tѧÀú\tÄêÁä\t¹¤×Ê\tµØÖ·\tµç»°endl;coutw[k].num'\t'w[k].name'\t'w[k].sex'\t'w[k].edu'\t'w[k].age'\t'w[k].salary'\t'w[k].address'\t'w[k].telendl;coutendl;//ÐèÒªÐ޸ĵÄÐÅÏ¢ÄÚÈݲ˵¥cout***********************************************endl;cout**1.Ð޸ŤºÅ**endl;cout**2.ÐÞ¸ÄÐÕÃû**endl;cout**3.ÐÞ¸ÄÐÔ±ð**endl;cout**4.ÐÞ¸ÄѧÀú**endl;cout**5.ÐÞ¸ÄÄêÁä**endl;cout**6.Ð޸Ť×Ê**endl;cout**7.Ð޸ĵØÖ·**endl;cout**8.Ð޸ĵ绰**endl;cout**0.·µ»ØÖ÷²Ëµ¥**endl;cout***********************************************endl;coutendl;coutÇëÑ¡ÔñÊý×Ö±àºÅ1~8endl;intc;cinc;while(c0||c8){coutÊäÈëÓÐÎó£¬ÇëÖØÐÂÊäÈ룺endl;cinc;}switch(c){case1:coutÇëÊäÈëеÄÖ°¹¤¹¤ºÅ:;cinw[k].num;coutÐÞ¸ÄÐÅÏ¢Òѱ£´æ£¬ÏÖ·µ»ØÖ÷²Ëµ¥£ºendl;menu();break;case2:coutÇëÊäÈëеÄÖ°¹¤ÐÕÃû:;cinw[k].name;coutÐÞ¸ÄÐÅÏ¢Òѱ£´æ£¬ÏÖ·µ»ØÖ÷²Ëµ¥£ºendl;menu();break;case3:coutÇëÊäÈëеÄÖ°¹¤ÐÔ±ð:;cinw[k].sex;coutÐÞ¸ÄÐÅÏ¢Òѱ£´æ£¬ÏÖ·µ»ØÖ÷²Ëµ¥£ºendl;menu();break;case4:coutÇëÊäÈëеÄÖ°¹¤Ñ§Àú:;cinw[k].edu;coutÐÞ¸ÄÐÅÏ¢Òѱ£´æ£¬ÏÖ·µ»ØÖ÷²Ëµ¥£ºendl;menu();break;case5:coutÇëÊäÈëеÄÖ°¹¤ÄêÁä:;cinw[k].age;coutÐÞ¸ÄÐÅÏ¢Òѱ£´æ£¬ÏÖ·µ»ØÖ÷²Ëµ¥£ºendl;menu();break;case6:coutÇëÊäÈëеÄÖ°¹¤¹¤×Ê:;cinw[k].salary;coutÐÞ¸ÄÐÅÏ¢Òѱ£´æ£¬ÏÖ·µ»ØÖ÷²Ëµ¥£ºendl;menu();break;case7:coutÇëÊäÈëеÄÖ°¹¤µØÖ·:;cinw[k].address;coutÐÞ¸ÄÐÅÏ¢Òѱ£´æ£¬ÏÖ·µ»ØÖ÷²Ëµ¥£ºendl;menu();break;case8:coutÇëÊäÈëеÄÖ°¹¤µç»°:;cinw[k].tel;coutÐÞ¸ÄÐÅÏ¢Òѱ£´æ£¬ÏÖ·µ»ØÖ÷²Ëµ¥£ºendl;menu();break;case0:menu();default:break;}}voidWorkerList::save()//Ö°¹¤ÐÅÏ¢±£´æº¯Êý¶¨Òå{if(NUM=0){coutûÓÐÖ°¹¤ÐÅÏ¢´æÈ룬ϵͳ½«·µ»ØÖ÷²Ëµ¥endl;menu();}else{ofstreamout;ifstreamin;out.open(E:\\worker.txt,ios::out);coutÊý¾Ý±£´æ³É¹¦£¡£¡£¡endl;coutÒѱ£´æÔ±¹¤ÐÅÏ¢ÈçÏ£ºendl;cout¹¤ºÅ\tÐÕÃû\tÐÔ±ð\tѧÀú\tÄêÁä\t¹¤×Ê\tµØÖ·\tµç»°endl;//Êä³ö±£´æºóµÄÔ±¹¤ÐÅÏ¢±ífor(inti=0;icount;i++)coutw[i].num'\t'w[i].name'\t'w[i].sex'\t'w[i].edu'\t'w[i].age'\t'w[i].salary'\t'w[i].address'\t'w[i].telendl;coutϵͳ·µ»ØÖ÷²Ëµ¥£ºendl;menu();out.close();}}voidWorkerList::visitworker()//Ö°¹¤ÐÅÏ¢ÏÔʾº¯ÊýʵÏÖ{if(NUM=0){coutûÓÐÖ°¹¤ÐÅÏ¢´æÈ룬ϵͳ½«·µ»ØÖ÷²Ëµ¥endl;menu();}elsecoutÒѱ£´æµÄÖ°¹¤ÐÅÏ¢ÈçÏ£ºendl;cout¹¤ºÅ\tÐÕÃû\tÐÔ±ð\tѧÀú\tÄêÁä\t¹¤×Ê\tµØÖ·\tµç»°endl;for(inti=0;icount;i++)coutw[i].num'\t'w[i].name'\t'w[i].sex'\t'w[i].edu'\t'w[i].age'\t'w[i].salary'\t'w[i].address'\t'w[i].tel