版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡介
C++面向?qū)ο蟪绦蛟O(shè)計(jì)課程設(shè)計(jì)報(bào)告課程名稱C++面向?qū)ο蟪绦蛟O(shè)計(jì)課題名稱企業(yè)人員信息管理系統(tǒng)專業(yè)班級(jí)學(xué)號(hào)姓名指導(dǎo)老師12月25日
(一)、課程設(shè)計(jì)題目企業(yè)人員信息管理系統(tǒng)、目標(biāo)和要求:1、目標(biāo):(1)要求學(xué)生達(dá)成熟練掌握C++語言基礎(chǔ)知識(shí)和技能;(2)基礎(chǔ)掌握面向?qū)ο蟪绦蛟O(shè)計(jì)基礎(chǔ)思緒和方法;(3)能夠利用所學(xué)基礎(chǔ)知識(shí)和技能,處理簡單面向?qū)ο蟪绦蛟O(shè)計(jì)問題。2、基礎(chǔ)要求:(1)要求利用面向?qū)ο蠓椒ê虲++編程思想來完成系統(tǒng)設(shè)計(jì);(2)要求在設(shè)計(jì)過程中,建立清楚類層次;(3)在系統(tǒng)中最少要定義四個(gè)類,每個(gè)類中要有各自屬性和方法;(4)在系統(tǒng)設(shè)計(jì)中,最少要用到面向?qū)ο笠粋€(gè)機(jī)制。3、創(chuàng)新要求:在基礎(chǔ)要求達(dá)成后,可進(jìn)行創(chuàng)新設(shè)計(jì),如依據(jù)查找結(jié)果進(jìn)行修改功效。(三)、設(shè)計(jì)方法和基礎(chǔ)原理:1.功效要求(1)添加功效程序能夠任意添加上述四類人員統(tǒng)計(jì),可提供選擇界面供用戶選擇所要添加人員類別,要求人員編號(hào)要唯一,假如添加了反復(fù)編號(hào)統(tǒng)計(jì)時(shí),則提醒用戶數(shù)據(jù)添加反復(fù)并取消添加。(2)查詢功效可依據(jù)編號(hào)、姓名等信息對(duì)已添加統(tǒng)計(jì)進(jìn)行查詢。假如未找到,給出對(duì)應(yīng)提醒信息,假如找到,則顯示對(duì)應(yīng)統(tǒng)計(jì)信息。(3)顯示功效可顯示目前系統(tǒng)中全部統(tǒng)計(jì)。(4)修改功效可依據(jù)查詢結(jié)果對(duì)對(duì)應(yīng)統(tǒng)計(jì)進(jìn)行修改,修改時(shí)注意編號(hào)唯一性。(5)刪除功效對(duì)已添加人員統(tǒng)計(jì)進(jìn)行刪除。假如目前系統(tǒng)中沒有對(duì)應(yīng)人員統(tǒng)計(jì),則提醒“統(tǒng)計(jì)為空!”并返回操作;不然輸入要?jiǎng)h除人員編號(hào)或姓名,依據(jù)所輸入信息刪除該人員統(tǒng)計(jì),假如沒有找到該人員信息,則提醒對(duì)應(yīng)統(tǒng)計(jì)不存在。(6)統(tǒng)計(jì)功效能依據(jù)多個(gè)參數(shù)進(jìn)行人員統(tǒng)計(jì)。比如:統(tǒng)計(jì)四類人員數(shù)量和總數(shù),統(tǒng)計(jì)男、女職員數(shù)量,統(tǒng)計(jì)平均工資、最高工資、最低工資等。(7)保留功效將目前系統(tǒng)中各類人員統(tǒng)計(jì)存入文件中。(8)讀取功效將保留在文件中人員信息讀入到目前系統(tǒng)中,以供用戶使用。在完成以上基礎(chǔ)功效基礎(chǔ)上,可自行進(jìn)行擴(kuò)展或完善。2、問題處理方案:依據(jù)系統(tǒng)功效要求,能夠?qū)栴}處理分為以下步驟:1)應(yīng)用系統(tǒng)分析,建立該系統(tǒng)功效模塊框圖和界面組織和設(shè)計(jì);2)分析系統(tǒng)中各個(gè)實(shí)體和它們之間關(guān)系;3)依據(jù)問題描述,設(shè)計(jì)系統(tǒng)類層次;4)完成類層次中各個(gè)類描述;5)完成類中各個(gè)組員函數(shù)定義;6)完成系統(tǒng)應(yīng)用模塊;7)功效調(diào)試;8)完成系統(tǒng)總結(jié)匯報(bào)。目錄TOC\o"1-2"\h\z\u1. 系統(tǒng)需求分析 12. 總體設(shè)計(jì) 23. 具體設(shè)計(jì)及實(shí)現(xiàn) 34. 系統(tǒng)調(diào)試 65. 結(jié)論 86. 心得體會(huì) 97. 參考書目 10系統(tǒng)需求分析1.1系統(tǒng)設(shè)計(jì)目標(biāo)和意義:現(xiàn)在企業(yè)越做越大,企業(yè)人員數(shù)量越來越多,所以需要一個(gè)企業(yè)人員管理系統(tǒng)來對(duì)企業(yè)人員進(jìn)行管理。1.2系統(tǒng)功效需求:本系統(tǒng)有五個(gè)類:Stuff類、Manager類、Salesman類、SalesManager類、Technicist類,存放基礎(chǔ)信息、經(jīng)理信息、銷售人員信息、銷售經(jīng)理信息及技術(shù)人員信息。1.基礎(chǔ)信息添加功效程序能夠任意添加經(jīng)理信息、銷售信息、銷售經(jīng)理信息和技術(shù)人員信息。2.修改功效對(duì)已添加統(tǒng)計(jì)(經(jīng)理信息、銷售信息、銷售經(jīng)理信息和技術(shù)人員信息)進(jìn)行修改。3.刪除功效對(duì)已添加統(tǒng)計(jì)(經(jīng)理信息、銷售信息、銷售經(jīng)理信息和技術(shù)人員信息)進(jìn)行刪除。假如目前系統(tǒng)中沒有對(duì)應(yīng)統(tǒng)計(jì),則提醒“統(tǒng)計(jì)為空!”并返回操作;不然輸入要?jiǎng)h除編號(hào)對(duì)該統(tǒng)計(jì)進(jìn)行刪除,假如沒有找到,則提醒對(duì)應(yīng)統(tǒng)計(jì)不存在。4.查詢功效①可依據(jù)職位編號(hào)查詢某職位全部職員信息。②可依據(jù)職員編號(hào)查詢某職員全部信息。假如未找到,給出對(duì)應(yīng)提醒信息,假如找到,則顯示對(duì)應(yīng)統(tǒng)計(jì)信息。5.保留功效將目前系統(tǒng)中各類統(tǒng)計(jì)存入文件中。6.讀取功效將保留在文件中信息讀入到目前系統(tǒng)中,以供用戶使用。總體設(shè)計(jì)2.1系統(tǒng)功效分析:系統(tǒng)經(jīng)過調(diào)用函數(shù)來實(shí)現(xiàn)信息錄入、信息修改、信息刪除、信息查詢和數(shù)據(jù)保留文件等功效。add()函數(shù)用于錄入信息;modify()函數(shù)用來修改信息;del()函數(shù)用來修改信息;look()函數(shù)用來搜索職員信息;read()函數(shù)用于將文件中數(shù)據(jù)讀取到內(nèi)存中;save()函數(shù)用于將內(nèi)存中信息存入文件內(nèi);count用于統(tǒng)計(jì)職員總數(shù);show()顯示職員信息;主函數(shù)main()用于調(diào)用這些函數(shù)。2.2系統(tǒng)功效模塊劃分和設(shè)計(jì):系統(tǒng)定義了Stuff類、Manager類、Salesman類、SalseManager類這五個(gè)類,定義了add()、modify()、del()、read()、save()、look()、count()、show()、等函數(shù)來實(shí)現(xiàn)系統(tǒng)所需功效。2.3系統(tǒng)功效模塊圖:企業(yè)人員信息管理系統(tǒng)企業(yè)人員信息管理系統(tǒng)技術(shù)人員信息添加技術(shù)人員信息查詢技術(shù)人員信息顯示技術(shù)人員信息修改技術(shù)人員信息刪除技術(shù)人員信息統(tǒng)計(jì)技術(shù)人員信息保留技術(shù)人員信息讀取技術(shù)人員信息管理銷售經(jīng)理信息添加銷售經(jīng)理信息查詢銷售經(jīng)理信息顯示銷售經(jīng)理信息修改銷售經(jīng)理信息刪除銷售經(jīng)理信息統(tǒng)計(jì)銷售經(jīng)理信息保留銷售經(jīng)理信息讀取銷售經(jīng)理信息管理銷售人員信息添加銷售人員信息查詢銷售人員信息顯示銷售人員信息修改銷售人員信息刪除銷售人員信息統(tǒng)計(jì)銷售人員信息保留銷售人員信息讀取銷售人員信息管理經(jīng)理信息添加經(jīng)理信息查詢經(jīng)理信息顯示經(jīng)理信息修改經(jīng)理信息刪除經(jīng)理信息統(tǒng)計(jì)經(jīng)理信息保留經(jīng)理信息讀取經(jīng)理信息管理2.4類設(shè)計(jì)(1)Stuff類(抽象類)設(shè)計(jì):StuffStuffvirtualvoidread()=0;virtualvoidadd()=0; virtualvoidmodify(int)=0;virtualvoiddel(int)=0;virtualvoidsave()=0;Virtualvoidlook()=0;Virtualvoidcount()=0;Virtualvoidshow()=0;VirtualvoidInput()=0;VirtualvoidOutput()=0;(2)經(jīng)理類設(shè)計(jì):ManagerManagerfloatpay;voidread();voidadd();voidlook();voidshow();voidmodify(int);voiddel(int);voidcount();voidsave();voidInput()(3)銷售人員類設(shè)計(jì):SalesmanSalesmanfloatmarket;floatrate;voidread(); voidadd(); voidlook(); voidshow(); voidmodify(int);voiddel(int);voidcount();voidsave();voidInput()(4)銷售經(jīng)理類設(shè)計(jì):SalesManagerSalesManagerfloatpay1,market1,rate1;voidread();voidadd(); voidlook(); voidshow(); voidmodify(int);voiddel(int);voidcount();voidsave();voidInput();(5)技術(shù)人員類設(shè)計(jì):TechnicistTechnicistfloathour;voidread(); voidadd(); voidlook(); voidshow(); voidmodify(int);voiddel(int);voidcount(); voidsave();voidInput()Technicistfloathour;voidread();Technicistfloathour;voidread();voidadd();voidlook();voidshow();voidmodify(int);voiddel(int);voidcount();voidsave();voidInput()Stuffvirtualvoidread()=0;virtualvoidadd()=0; virtualvoidmodify(int)=0;virtualvoiddel(int)=0;virtualvoidsave()=0;Virtualvoidlook()=0;Virtualvoidcount()=0;Virtualvoidshow()=0;VirtualvoidInput()=0;VirtualvoidOutput()=0;Managerfloatpay;voidread();voidadd();voidlook();voidshow();Voidmodify(int);voiddel(int);voidcount();voidsave();voidInput();voidInput()Salesmanfloatmarket;floatrate;voidread();voidadd();voidlook();voidshow();voidmodify(int);voiddel(int);voidcount();voidsave();voidInput()SalesManagerfloatpay1,market1,rate1;voidread();voidadd();voidlook();voidshow();voidmodify(int);voiddel(int);voidcount();voidsave();voidInput();Salesmanfloatmarket;floatrate;voidread();voidadd();voidlook();voidshow();voidmodify(int);voiddel(int);voidcount();voidsave();voidInput()ManagerfloatpayManagerfloatpay;voidread();voidadd();voidlook();voidshow();Voidmodify(int);voiddel(int);voidcount();voidsave();voidInput();voidInput()SalesManagerfloatpay1,market1,rate1;voidread();voidadd();voidlook();SalesManagerfloatpay1,market1,rate1;voidread();voidadd();voidlook();voidshow();voidmodify(int);voiddel(int);voidcount();voidsave();voidInput();Stuffvirtualvoidread()=0;virtualvoidadd()=0; virtualvoidmodify(int)=0;virtualvoiddel(int)=0;virtualvoidsave()=0;Virtualvoidlook()=0;Virtualvoidcount()=0;Virtualvoidshow()=0;VirtualvoidInput()=0;VirtualvoidOutput()=0;具體設(shè)計(jì)及實(shí)現(xiàn)3.1Stuff類(抽象類)實(shí)現(xiàn)classStuff{public: virtualvoidread()=0; virtualvoidadd()=0; virtualvoidlook()=0; virtualvoidshow()=0; virtualvoidmodify(int)=0; virtualvoiddel(int)=0;virtualvoidcount()=0; virtualvoidsave()=0;virtualvoidInput()=0;virtualvoidOutput()=0;intnumber; charname[100];charsex[10]; chardepartment[10]; charrank[10];floatmonpay;};3.2經(jīng)理類實(shí)現(xiàn)#include"Stuff.h"classManager:publicStuff{public: voidread(); voidadd(); voidlook(); voidshow(); voidmodify(int);voiddel(int);voidcount(); voidsave();voidInput() {cout<<"請(qǐng)輸入經(jīng)理編號(hào):\n"; cin>>number; cout<<"姓名:\n"; cin>>name; cout<<"性別:\n"; cin>>sex; cout<<"所在部門:\n"; cin>>department; cout<<"等級(jí):\n"; cin>>rank; cout<<"固定工資:\n"; cin>>pay; monpay=pay; } voidOutput() {cout<<setw(10)<<"經(jīng)理信息"<<setw(10)<<"編號(hào)"<<setw(10)<<"姓名"<<setw(10)<<"性別"<<setw(10)<<"所在部門"<<setw(10)<<"等級(jí)"<<setw(10)<<"月薪"<<endl; cout<<setw(10)<<"經(jīng)理信息"<<setw(10)<<number<<setw(10)<<name<<setw(10)<<sex<<setw(10)<<department<<setw(10)<<rank<<setw(10)<<monpay<<endl;}protected:floatpay;};Manager.cppvoidManager::read(){fstreammanagerfile("經(jīng)理信息管理.dat",ios::in|ios::out);managerfile>>m1[count_Manager].number>>m1[count_Manager].name>>m1[count_Manager].sex>>m1[count_Manager].department>>m1[count_Manager].rank>>m1[count_Manager].monpay; while(!managerfile.eof()) {managerfile>>m1[count_Manager].number>>m1[count_Manager].name>>m1[count_Manager].sex>>m1[count_Manager].department>>m1[count_Manager].rank>>m1[count_Manager].monpay;count_Manager++; } managerfile.close();}voidManager::add(){ m1[count_Manager].number=number;strcpy(m1[count_Manager].name,name);strcpy(m1[count_Manager].sex,sex);strcpy(m1[count_Manager].department,department);strcpy(m1[count_Manager].rank,rank);m1[count_Manager].monpay=monpay;m1[count_Manager].number=number;count_Manager++;}voidManager::look(){if(count_Manager==0){cout<<"對(duì)不起,沒有相關(guān)統(tǒng)計(jì)!"<<endl;return;}intchoice;cout<<"請(qǐng)選擇查找方法:1、編號(hào)查找2、姓名查找"<<endl;cin>>choice;while(choice!=1&&choice!=2) {cout<<"請(qǐng)輸入正確選擇:";cin>>choice;}switch(choice){ case1: { cout<<"請(qǐng)輸入要查找經(jīng)理編號(hào):"; intnumber; cin>>number; for(inti=0;i<count_Manager;i++) {if(m1[i].number==number) { m1[i].Output(); return; } } cout<<"沒有相關(guān)人員!"<<endl; break; } case2: { cout<<"請(qǐng)輸入要查找經(jīng)理姓名:";charname[100]; cin>>name; for(inti=0;i<count_Manager;i++) { if(strcmp(m1[i].name,name)==0) { m1[i].Output(); return; } } cout<<"沒有相關(guān)人員!"<<endl; break; } default:cout<<"無此選項(xiàng),請(qǐng)重試!"<<endl;break; }}voidManager::show(){for(inti=0;i<=count_Manager-1;i++) m1[i].Output(); }voidManager::modify(intindex){m1[index-1].number=number;strcpy(m1[index-1].name,name);strcpy(m1[index-1].sex,sex); strcpy(m1[index-1].department,department); strcpy(m1[index-1].rank,rank);m1[index-1].monpay=monpay;}voidManager::del(intindex){for(inti=index;i<=count_Manager-1;i++) { m1[i-1].number=m1[i].number; strcpy(m1[i-1].name,m1[i].name);strcpy(m1[i-1].sex,m1[i].sex); strcpy(m1[i-1].department,m1[i].department); strcpy(m1[i-1].rank,m1[i].rank);m1[i-1].monpay=m1[i].monpay; } count_Manager--;}voidManager::count(){intsum=0; intmale=0,female=0; for(inti=0;i<count_Manager;i++) { if(!strcmp(m1[i].sex,"男")) male++; if(!strcmp(m1[i].sex,"女")) female++; sum++; } cout<<"總?cè)藬?shù)是: "<<sum<<endl; cout<<"男人數(shù)是: "<<male<<endl; cout<<"女人數(shù)是: "<<female<<endl;}voidManager::save(){ ofstreammanagerfile; managerfile.open("經(jīng)理信息管理.dat"); for(inti=0;i<=count_Manager-1;i++) managerfile<<m1[i].number<<""<<m1[i].name<<""<<m1[i].sex<<""<<m1[i].department<<""<<m1[i].rank<<""<<m1[i].monpay<<endl;managerfile.close();}3.3銷售人員類實(shí)現(xiàn)#include"Stuff.h"classSalesman:publicStuff{public: voidread(); voidadd(); voidlook();voidshow(); voidmodify(int);voiddel(int);voidcount(); voidsave();voidInput() { cout<<"請(qǐng)輸入銷售人員編號(hào):\n"; cin>>number; cout<<"姓名:\n"; cin>>name; cout<<"性別:\n"; cin>>sex; cout<<"所在部門:\n"; cin>>department; cout<<"等級(jí):\n"; cin>>rank; cout<<"銷售額和分成百分比:\n"; cin>>market>>rate; monpay=market*rate; } voidOutput() { cout<<setw(10)<<"銷售人員信息"<<setw(10)<<"編號(hào)"<<setw(10)<<"姓名"<<setw(10)<<"性別"<<setw(10)<<"所在部門"<<setw(10)<<"等級(jí)"<<setw(10)<<"月薪"<<endl; cout<<setw(10)<<"經(jīng)理信息"<<setw(10)<<number<<setw(10)<<name<<setw(10)<<sex<<setw(10)<<department<<setw(10)<<rank<<setw(10)<<monpay<<endl; }protected:floatmarket;floatrate;};Salesman.cppvoidSalesman::read(){fstreamSalesmanfile("銷售人員信息管理.dat",ios::in|ios::out);Salesmanfile>>s1[count_Salesman].number>>s1[count_Salesman].name>>s1[count_Salesman].sex>>s1[count_Salesman].department>>s1[count_Salesman].rank>>s1[count_Salesman].monpay;while(!Salesmanfile.eof()){Salesmanfile>>s1[count_Salesman].number>>s1[count_Salesman].name>>s1[count_Salesman].sex>>s1[count_Salesman].department>>s1[count_Salesman].rank>>s1[count_Salesman].monpay; count_Salesman++; } Salesmanfile.close();}voidSalesman::add(){ s1[count_Salesman].number=number;strcpy(s1[count_Salesman].name,name);strcpy(s1[count_Salesman].sex,sex); strcpy(s1[count_Salesman].department,department); strcpy(s1[count_Salesman].rank,rank);s1[count_Salesman].monpay=monpay;count_Salesman++;}voidSalesman::look(){if(count_Salesman==0){cout<<"對(duì)不起,沒有相關(guān)統(tǒng)計(jì)!"<<endl;return;}intchoice;cout<<"請(qǐng)選擇查找方法:1、編號(hào)查找2、姓名查找"<<endl;cin>>choice;while(choice!=1&&choice!=2) {cout<<"請(qǐng)輸入正確選擇:";cin>>choice;}switch(choice){ case1: { cout<<"請(qǐng)輸入要查找銷售人員編號(hào):"; intnumber; cin>>number; for(inti=0;i<count_Salesman;i++) {if(s1[i].number==number) { s1[i].Output(); return; } } cout<<"沒有相關(guān)人員!"<<endl; break; } case2: { cout<<"請(qǐng)輸入要查找銷售人員姓名:";charname[100]; cin>>name; for(inti=0;i<count_Salesman;i++) { if(strcmp(s1[i].name,name)==0) { s1[i].Output(); return; } } cout<<"沒有相關(guān)人員!"<<endl; break; } default:cout<<"無此選項(xiàng),請(qǐng)重試!"<<endl;break; }}voidSalesman::show(){for(inti=0;i<=count_Salesman-1;i++) s1[i].Output(); }voidSalesman::modify(intindex){s1[index-1].number=number;strcpy(s1[index-1].name,name);strcpy(s1[index-1].sex,sex); strcpy(s1[index-1].department,department); strcpy(s1[index-1].rank,rank);s1[index-1].monpay=monpay;}voidSalesman::del(intindex){for(inti=index;i<=count_Salesman-1;i++) { s1[i-1].number=s1[i].number; strcpy(s1[i-1].name,s1[i].name);strcpy(s1[i-1].sex,s1[i].sex); strcpy(s1[i-1].department,s1[i].department); strcpy(s1[i-1].rank,s1[i].rank);s1[i-1].monpay=s1[i].monpay; } count_Salesman--;}voidSalesman::count(){intsum2=0; intmale2=0,female2=0; for(inti=0;i<count_Salesman;i++) { if(!strcmp(s1[i].sex,"男")) male2++; if(!strcmp(s1[i].sex,"女")) female2++; sum2++; } cout<<"總?cè)藬?shù)是: "<<sum2<<endl; cout<<"男人數(shù)是: "<<male2<<endl; cout<<"女人數(shù)是: "<<female2<<endl;}voidSalesman::save(){ ofstreamSalesmanfile; Salesmanfile.open("銷售人員信息管理.dat"); for(inti=0;i<=count_Salesman-1;i++) Salesmanfile<<s1[i].number<<""<<s1[i].name<<""<<s1[i].sex<<""<<s1[i].department<<""<<s1[i].rank<<""<<s1[i].monpay<<endl;Salesmanfile.close();}3.4銷售經(jīng)理類實(shí)現(xiàn)Salesmanager.hclassSalesmanager:publicStuff{public:floatpay1,market1,rate1;voidread(); voidadd(); voidlook(); voidshow(); voidmodify(int);voiddel(int);voidcount(); voidsave();voidInput() { cout<<"請(qǐng)輸入銷售經(jīng)理編號(hào):\n"; cin>>number; cout<<"姓名:\n"; cin>>name; cout<<"性別:\n"; cin>>sex; cout<<"所在部門:\n"; cin>>department; cout<<"等級(jí):\n"; cin>>rank;cout<<"固定工資、銷售額和分成率:\n"; cin>>pay1>>"">>market1>>"">>rate1; monpay=market1*rate1+pay1; } voidOutput() { cout<<setw(10)<<"銷售經(jīng)理信息"<<setw(10)<<"編號(hào)"<<setw(10)<<"姓名"<<setw(10)<<"性別"<<setw(10)<<"所在部門"<<setw(10)<<"等級(jí)"<<setw(10)<<"月薪"<<endl; cout<<setw(10)<<"經(jīng)理信息"<<setw(10)<<number<<setw(10)<<name<<setw(10)<<sex<<setw(10)<<department<<setw(10)<<rank<<setw(10)<<monpay<<endl; }};Sslesmanager.cppvoidSalesmanager::read(){fstreamSalesmanagerfile("銷售經(jīng)理信息管理.dat",ios::in|ios::out);Salesmanagerfile>>ss1[count_Salesmanager].number>>ss1[count_Salesmanager].name>>ss1[count_Salesmanager].sex>>ss1[count_Salesmanager].department>>ss1[count_Salesmanager].rank>>ss1[count_Salesmanager].monpay;while(!Salesmanagerfile.eof()){Salesmanagerfile>>ss1[count_Salesmanager].number>>ss1[count_Salesmanager].name>>ss1[count_Salesmanager].sex>>ss1[count_Salesmanager].department>>ss1[count_Salesmanager].rank>>ss1[count_Salesmanager].monpay;count_Salesmanager++;}Salesmanagerfile.close();}voidSalesmanager::add(){ss1[count_Salesmanager].number=number;strcpy(ss1[count_Salesmanager].name,name);strcpy(ss1[count_Salesmanager].sex,sex); strcpy(ss1[count_Salesmanager].department,department); strcpy(ss1[count_Salesmanager].rank,rank);ss1[count_Salesmanager].monpay=monpay;count_Salesmanager++;}voidSalesmanager::look(){if(count_Salesmanager==0){cout<<"對(duì)不起,沒有相關(guān)統(tǒng)計(jì)!"<<endl;return;}intchoice;cout<<"請(qǐng)選擇查找方法:1、編號(hào)查找2、姓名查找"<<endl;cin>>choice;while(choice!=1&&choice!=2) {cout<<"請(qǐng)輸入正確選擇:";cin>>choice;}{ case1: { cout<<"請(qǐng)輸入要查找銷售經(jīng)理編號(hào):"; intnumber; cin>>number; for(inti=0;i<count_Salesmanager;i++) {if(ss1[i].number==number) { ss1[i].Output(); return; } } cout<<"沒有相關(guān)人員!"<<endl; break; } case2: { cout<<"請(qǐng)輸入要查找銷售經(jīng)理姓名:";charname[100]; cin>>name; for(inti=0;i<count_Salesmanager;i++) { if(strcmp(ss1[i].name,name)==0) { ss1[i].Output(); return; } } cout<<"沒有相關(guān)人員!"<<endl; break; } default:cout<<"無此選項(xiàng),請(qǐng)重試!"<<endl;break; }}voidSalesmanager::show(){for(inti=0;i<=count_Salesmanager-1;i++) ss1[i].Output(); }voidSalesmanager::modify(intindex){ss1[index-1].number=number;strcpy(ss1[index-1].name,name);strcpy(ss1[index-1].sex,sex); strcpy(ss1[index-1].department,department); strcpy(ss1[index-1].rank,rank);ss1[index-1].monpay=monpay;}voidSalesmanager::del(intindex){for(inti=index;i<=count_Salesmanager-1;i++) { ss1[i-1].number=ss1[i].number; strcpy(ss1[i-1].name,ss1[i].name);strcpy(ss1[i-1].sex,ss1[i].sex); strcpy(ss1[i-1].department,ss1[i].department); strcpy(ss1[i-1].rank,ss1[i].rank);ss1[i-1].monpay=ss1[i].monpay; } count_Salesmanager--;}voidSalesmanager::count(){intsum2=0; intmale2=0,female2=0; for(inti=0;i<count_Salesmanager;i++) { if(!strcmp(ss1[i].sex,"男")) male2++; if(!strcmp(ss1[i].sex,"女")) female2++; sum2++; } cout<<"總?cè)藬?shù)是: "<<sum2<<endl; cout<<"男人數(shù)是: "<<male2<<endl; cout<<"女人數(shù)是: "<<female2<<endl;}voidSalesmanager::save(){ ofstreamSalesmanagerfile; Salesmanagerfile.open("銷售經(jīng)理信息管理.dat"); for(inti=0;i<=count_Salesmanager-1;i++) Salesmanagerfile<<ss1[i].number<<""<<ss1[i].name<<""<<ss1[i].sex<<""<<ss1[i].department<<""<<ss1[i].rank<<""<<ss1[i].monpay<<endl;Salesmanagerfile.close();}3.5技術(shù)人員類實(shí)現(xiàn)Technicist.hclassTechnicist:publicStuff{public:voidread();voidadd();voidlook();voidshow();voidmodify(int);voiddel(int);voidcount();voidsave();voidInput() { cout<<"請(qǐng)輸入技術(shù)人員編號(hào):\n"; cin>>number; cout<<"姓名:\n"; cin>>name; cout<<"性別:\n"; cin>>sex; cout<<"所在部門:\n"; cin>>department; cout<<"等級(jí):\n"; cin>>rank; cout<<"工作時(shí)數(shù):\n"; cin>>hour; monpay=100*hour; } voidOutput() { cout<<setw(10)<<"技術(shù)人員信息"<<setw(10)<<"編號(hào)"<<setw(10)<<"姓名"<<setw(10)<<"性別"<<setw(10)<<"所在部門"<<setw(10)<<"等級(jí)"<<setw(10)<<"月薪"<<endl; cout<<setw(10)<<"技術(shù)人員信息"<<setw(10)<<number<<setw(10)<<name<<setw(10)<<sex<<setw(10)<<department<<setw(10)<<rank<<setw(10)<<monpay<<endl; }protected:floathour;};Technicist.cppvoidTechnicist::read(){fstreamTechnicistfile("技術(shù)人員信息管理.dat",ios::in|ios::out);Technicistfile>>t1[count_Technicist].number>>t1[count_Technicist].name>>t1[count_Technicist].sex>>t1[count_Technicist].department>>t1[count_Technicist].rank>>t1[count_Technicist].monpay; while(!Technicistfile.eof()) { Technicistfile>>t1[count_Technicist].number>>t1[count_Technicist].name>>t1[count_Technicist].sex>>t1[count_Technicist].department>>t1[count_Technicist].rank>>t1[count_Technicist].monpay; count_Technicist++; } Technicistfile.close();}voidTechnicist::add(){ t1[count_Technicist].number=number;strcpy(t1[count_Technicist].name,name);strcpy(t1[count_Technicist].sex,sex); strcpy(t1[count_Technicist].department,department); strcpy(t1[count_Technicist].rank,rank);t1[count_Technicist].monpay=monpay;count_Technicist++;}voidTechnicist::look(){if(count_Technicist==0){cout<<"對(duì)不起,沒有相關(guān)統(tǒng)計(jì)!"<<endl;return;}intchoice;cout<<"請(qǐng)選擇查找方法:1、編號(hào)查找2、姓名查找"<<endl;cin>>choice;while(choice!=1&&choice!=2) {cout<<"請(qǐng)輸入正確選擇:";cin>>choice;}switch(choice){ case1: { cout<<"請(qǐng)輸入要查找技術(shù)人員編號(hào):"; intnumber; cin>>number; for(inti=0;i<count_Technicist;i++) {if(t1[i].number==number) { t1[i].Output(); return; } } cout<<"沒有相關(guān)人員!"<<endl; break; } case2: { cout<<"請(qǐng)輸入要查找技術(shù)人員姓名:";charname[100]; cin>>name; for(inti=0;i<count_Technicist;i++) { if(strcmp(t1[i].name,name)==0) { t1[i].Output(); return; } } cout<<"沒有相關(guān)人員!"<<endl; break; } default:cout<<"無此選項(xiàng),請(qǐng)重試!"<<endl;break; }}voidTechnicist::show(){for(inti=0;i<=count_Technicist-1;i++) t1[i].Output(); }voidTechnicist::modify(intindex){t1[index-1].number=number;strcpy(t1[index-1].name,name);strcpy(t1[index-1].sex,sex); strcpy(t1[index-1].department,department); strcpy(t1[index-1].rank,rank);t1[index-1].monpay=monpay;}voidTechnicist::del(intindex){for(inti=index;i<=count_Technicist-1;i++) { t1[i-1].number=t1[i].number; strcpy(t1[i-1].name,t1[i].name);strcpy(t1[i-1].sex,t1[i].sex); strcpy(t1[i-1].department,t1[i].department); strcpy(t1[i-1].rank,t1[i].rank);t1[i-1].monpay=t1[i].monpay; } count_Technicist--;}voidTechnicist::count(){intsum1=0; intmale1=0,female1=0; for(inti=0;i<count_Technicist;i++) { if(!strcmp(t1[i].sex,"男")) male1++; if(!strcmp(t1[i].sex,"女")) female1++; sum1++; } cout<<"總?cè)藬?shù)是: "<<sum1<<endl; cout<<"男人數(shù)是: "<<male1<<endl; cout<<"女人數(shù)是: "<<female1<<endl;}voidTechnicist::save(){ ofstreamTechnicistfile; Technicistfile.open("技術(shù)人員信息管理.dat"); for(inti=0;i<=count_Technicist-1;i++) Technicistfile<<t1[i].number<<""<<t1[i].name<<""<<t1[i].sex<<""<<t1[i].department<<""<<t1[i].rank<<""<<t1[i].monpay<<endl;Technicistfile.close();}3.6main.cpp#include<iostream.h>#include<fstream.h>#include<string.h>#include<stdlib.h>#include<iomanip.h>#include"Stuff.h"#include"Manager.h"#include"Technicist.h"#include"Salesman.h"#include"Salesmanager.h"constintMAXMANAGER=100;constintMAXTECHNICIST=100;constintMAXSALESMAN=100;constintMAXSALESMANager=100;Managerm1[MAXMANAGER];Technicistt1[MAXTECHNICIST];Salesmans1[MAXSALESMAN];Salesmanagerss1[MAXSALESMANager];intcount_Manager=0;intcount_Technicist=0;intcount_Salesman=0;intcount_Salesmanager=0;Stuff*p=NULL;charout;//經(jīng)理管理子菜單voidManager_manage(){intchoice,i=0;boolquit=false;while(1){ system("cls");cout<<"***********經(jīng)理管理子菜單***********"<<endl;cout<<"1.添加經(jīng)理信息"<<endl;cout<<"2.查詢經(jīng)理信息"<<endl;cout<<"3.顯示經(jīng)理信息"<<endl;cout<<"4.修改經(jīng)理信息"<<endl;cout<<"5.刪除經(jīng)理信息"<<endl;cout<<"6.統(tǒng)計(jì)經(jīng)理人數(shù)"<<endl;cout<<"0.退出"<<endl;cout<<"**********************************"<<endl;cout<<"請(qǐng)輸入所要操作編號(hào):";cin>>choice;switch(choice) {case1: { Managerm2; p=&m2; cout<<"請(qǐng)輸入要添加經(jīng)理信息\n";m2.Input();for(inti=0;i<count_Manager;i++) if(m1[i].number==m2.number){cout<<"該編號(hào)經(jīng)理已存在!"<<endl;break;} if(m2.number>=MAXMANAGER) {cout<<"經(jīng)理庫已滿,無法添加!"<<endl;return;} else cout<<"是否保留經(jīng)理信息?(y/n)\n"; cin>>out; if(out=='y') { p->add(); p->save(); }break; }case2: { Managerm3; p=&m3; p->look(); system("pause"); break;} case3: { Managerm4; p=&m4;p->show();if(count_Manager==0) {cout<<"系統(tǒng)中無存放統(tǒng)計(jì)!"<<endl;} system("pause"); break; } case4: { Managerm5; p=&m5; if(count_Manager==0) {cout<<"系統(tǒng)中無存放統(tǒng)計(jì)!"<<endl;return;} intindex; p->show();cout<<"請(qǐng)選擇經(jīng)理編號(hào):\n"; cin>>index; for(inti=0;i<count_Manager;i++) if(m1[i].number==index) { cout<<"請(qǐng)對(duì)經(jīng)理信息進(jìn)行修改:"<<endl; p->Input();cout<<"是否保留經(jīng)理信息?(y/n)\n"; cin>>out; if(out=='y') { p->modify(index); p->save(); } return; } elsecout<<"無此經(jīng)理信息!"<<endl; system("pause"); break; } case5: { Managerm6; p=&m6; intindex; if(count_Manager==0) cout<<"經(jīng)理庫為空!"<<endl; else for(inti=0;i<=count_Manager-1;i++) cout<<m1[i].number<<""<<m1[i].name<<""<<m1[i].sex<<""<<m1[i].department<<""<<m1[i].rank<<""<<m1[i].monpay<<endl;cout<<"請(qǐng)選擇要?jiǎng)h除經(jīng)理編號(hào):\n"; cin>>index; for(inti=0;i<count_Manager;i++) { if(m1[i].number==index) { cout<<"繼續(xù)"<<endl; cout<<"是否保留經(jīng)理信息?(y/n)\n"; cin>>out; if(out=='y') { p->del(index); p->save(); } return; } } cout<<"該編號(hào)經(jīng)理信息不存在!"<<endl; system("pause"); break; } case6: { Managerm7; p=&m7; p->count();system("pause"); break; } case0: quit=true; break; default: cout<<"請(qǐng)輸入0~6之間數(shù)字!"<<endl; break; } if(quit==true) break; }system("cls");return;}//技術(shù)人員管理子菜單voidTechnicist_manage(){intchoice,i=0;boolquit=false;while(1){ system("cls");cout<<"*************技術(shù)人員信息管理子菜單*************"<<endl;cout<<"1.添加技術(shù)人員信息"<<endl;cout<<"2.查詢技術(shù)人員信息"<<endl;cout<<"3.顯示技術(shù)人員信息"<<endl;cout<<"4.修改技術(shù)人員信息"<<endl;cout<<"5.刪除技術(shù)人員信息"<<endl;cout<<"6.統(tǒng)計(jì)技術(shù)人員人數(shù)"<<endl;cout<<"0.退出"<<endl;cout<<"************************************************"<<endl;cout<<"請(qǐng)輸入所要操作編號(hào):";cin>>choice;switch(choice) {case1: { Technicistt2; p=&t2; cout<<"請(qǐng)輸入要添加技術(shù)人員信息\n";t2.Input();for(inti=0;i<count_Technicist;i++) if(t1[i].number==t2.number){cout<<"該編號(hào)技術(shù)人員已存在!"<<endl;break;} if(t2.number>=MAXTECHNICIST) {cout<<"技術(shù)人員庫已滿,無法添加!"<<endl;return;} else cout<<"是否保留技術(shù)人員信息?(y/n)\n"; cin>>out; if(out=='y') { p->add(); p->save(); }break; }case2: { Technicistt3; p=&t3; p->look(); system("pause"); break;} case3: { Technicistt4; p=&t4;p->show(); if(count_Technicist==0) {cout<<"系統(tǒng)中無存放統(tǒng)計(jì)!"<<endl;}system("pause"); break; }case4: { Technicistt5; p=&t5; if(count_Technicist==0) {cout<<"系統(tǒng)中無存放統(tǒng)計(jì)!"<<endl;return;} intindex; p->show();cout<<"請(qǐng)選擇技術(shù)人員編號(hào):\n"; cin>>index; for(inti=0;i<count_Technicist;i++) if(t1[i].number==index) { cout<<"請(qǐng)對(duì)技術(shù)人員信息進(jìn)行修改:"<<endl; p->Input();cout<<"是否保留技術(shù)人員信息?(y/n)\n"; cin>>out; if(out=='y') { p->modify(index); p->save(); } return; } cout<<"無此技術(shù)人員信息!"<<endl;system("pause"); break; } case5: { Technicistt6; p=&t6; intindex; if(count_Technicist==0) cout<<"技術(shù)人員庫為空!"<<endl; else for(inti=0;i<=count_Technicist-1;i++) cout<<t1[i].number<<""<<t1[i].name<<""<<t1[i].sex<<""<<t1[i].department<<""<<t1[i].rank<<""<<t1[i].monpay<<endl;cout<<"請(qǐng)選擇要?jiǎng)h除技術(shù)人員編號(hào):\n"; cin>>index; for(inti=0;i<count_Technicist;i++) { if(t1[i].number==index) { cout<<"繼續(xù)"<<endl; cout<<"是否保留技術(shù)人員信息?(y/n)\n"; cin>>out; if(out=='y') {
溫馨提示
- 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- GA/T 1003-2024銀行自助服務(wù)亭技術(shù)規(guī)范
- 銀行合規(guī)管理制度實(shí)施成效
- 高速公路安全行車管理制度
- 新學(xué)期美術(shù)教學(xué)工作計(jì)劃(23篇)
- 挑戰(zhàn)2024演講稿(31篇)
- 六年級(jí)下冊(cè)各具特色的民居課件
- 福建省泉州市惠安縣2023-2024學(xué)年七年級(jí)上學(xué)期期末考試數(shù)學(xué)試卷(含解析)
- 顧客服務(wù)政策的設(shè)計(jì)
- 7.2《歸園田居(其一)》課件 2024-2025學(xué)年統(tǒng)編版高中語文必修上冊(cè)
- 福州七中2025屆高考英語一模試卷含解析
- 高中英語U4-The-Words-That-Changed-A-Nation教學(xué)課件
- 大學(xué)生創(chuàng)業(yè)法律服務(wù)智慧樹知到期末考試答案2024年
- 中職學(xué)考《哲學(xué)與人生》考試復(fù)習(xí)題庫(含答案)
- 貨運(yùn)駕駛員崗前培訓(xùn)
- 滅火器維修與保養(yǎng)手冊(cè)
- 電梯日管控、周排查、月調(diào)度內(nèi)容表格
- 降低檢查報(bào)告錯(cuò)誤率品管圈護(hù)理課件
- 預(yù)防未成年人犯罪法主題班會(huì)
- 2024-2024年江蘇省普通高中學(xué)業(yè)水平測(cè)試物理試卷(含答案)
- 環(huán)衛(wèi)公司行業(yè)風(fēng)險(xiǎn)分析
- 信托行業(yè)保密知識(shí)培訓(xùn)
評(píng)論
0/150
提交評(píng)論