C程序設(shè)計(jì)實(shí)習(xí)報(bào)告_第1頁
C程序設(shè)計(jì)實(shí)習(xí)報(bào)告_第2頁
C程序設(shè)計(jì)實(shí)習(xí)報(bào)告_第3頁
C程序設(shè)計(jì)實(shí)習(xí)報(bào)告_第4頁
C程序設(shè)計(jì)實(shí)習(xí)報(bào)告_第5頁
已閱讀5頁,還剩28頁未讀 繼續(xù)免費(fèi)閱讀

付費(fèi)下載

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡介

.目錄一、實(shí)習(xí)內(nèi)容…………二、設(shè)計(jì)思路…………三、程序清單…………四、運(yùn)行結(jié)果…………五、程序使用說明……………………六、總結(jié)及心得體會………………….

..

.一、實(shí)習(xí)內(nèi)容課程設(shè)計(jì)的題目小型公司工資管理系統(tǒng)》設(shè)計(jì)設(shè)計(jì)說明:公司主要有四類人員:經(jīng)理、技術(shù)員、銷售員、銷售經(jīng)理。程序要求存儲這些人的職工號、姓名、月工資、年齡、性別等信息。并且應(yīng)用程序中要求給出菜單,用于選擇各項(xiàng)功能。一、程序要求實(shí)現(xiàn)的功能即菜單目錄有:1、數(shù)據(jù)輸入:輸入各種數(shù)據(jù);2、數(shù)據(jù)統(tǒng)計(jì):統(tǒng)計(jì)各銷售經(jīng)理下屬銷售員的銷售額及銷售額之和;銷售經(jīng)理工資進(jìn)行冒泡排序;3、數(shù)據(jù)打?。捍蛴「黝悊T工的數(shù)據(jù)信息;4、數(shù)據(jù)備份:把各類員工的數(shù)據(jù)信息寫入文件中保存;5、退出:退出本系統(tǒng),即結(jié)束程序的運(yùn)行。二、工資的計(jì)算方法A:經(jīng)理:固定月薪為元;B:技術(shù)員:工作時(shí)*小時(shí)工資(100元小時(shí)C:銷售員:銷售額*4%提成D:銷售經(jīng)理:底薪(5000)+所轄部門銷售額總額*0.5%。三、類的層次結(jié)構(gòu)大體如下雇員類↑技術(shù)員類

經(jīng)理類↓銷售經(jīng)理類

銷售員類.

.二、設(shè)計(jì)思路1.(1)首先我們要搞清楚各類之間的繼承關(guān)系,設(shè)置基類employee其派生類manager,technician,salesman。以manager類為,再派生一個(gè)salesmanager類將各類的數(shù)據(jù)成員設(shè)計(jì)成方便派生類對基類的繼承;(2public里編寫數(shù)據(jù)輸入的函數(shù)主函數(shù)中輸出菜單并定義各類的對象,通過對象來調(diào)用數(shù)據(jù)輸入函數(shù);2.(1)在基類employee中補(bǔ)充幾個(gè)返回各類數(shù)據(jù)的函數(shù)以用于返回輸入的各類值;(2)在主函數(shù)內(nèi)用冒泡法對銷售經(jīng)理的工資進(jìn)行排序,定義一wage[]來將各銷售經(jīng)理下面的銷售員的銷售額進(jìn)行儲存義一個(gè)用于計(jì)算銷售經(jīng)理的銷售總額,以便于下面對其進(jìn)行工資的計(jì)算;(3)第,3,4都用大量的for循環(huán)進(jìn)行輸出,以實(shí)現(xiàn)表格的形成還有表格中數(shù)據(jù)的輸入在主函數(shù)內(nèi)定義各類的對象然后都是直接通過類的對象調(diào)用類內(nèi)的函數(shù),運(yùn)用for循環(huán)進(jìn)行打印,統(tǒng)計(jì);3.備份參照課本格式,選擇路徑及格式,運(yùn)用for循環(huán)備份;就是那個(gè)fstream之類的東西退出系統(tǒng)用exit(5)函數(shù)實(shí)現(xiàn);4函數(shù)運(yùn)用switch語句上述功能編為case1~5個(gè)case后添加5.程序結(jié)束。以上是我所認(rèn)為的該程序的幾個(gè)要點(diǎn)…………………...

.三、程序清單#include<iostream>#include<string>#include<cmath>#include<iomanip>#include<fstream>usingnamespacestd;constN=2;fstreamoutfile;classemployee//基類,雇傭者{protected:stringname;charsex;intage;public:virtualvoiddisplay(){cout<<"其姓名:cin>>name;cout<<"性別(m/w):";cin>>sex;cout<<"年齡:cin>>age;}stringnam(){returnname;}charse(){returnsex;}intag(){returnage;}};//classtechnician:publicemployee//術(shù)員類.

.{public:intworktime;intnumber1;public:voiddisplay1(){cout<<"技術(shù)員的編號:cin>>number1;employee::display();cout<<"工作時(shí)間";cin>>worktime;}inttime(){returnworktime;}intnumb1(){returnnumber1;}};

//classmanager:publicemployee//經(jīng)理類{protected:intnumber2;public:voiddisplay2(){cout<<"經(jīng)理的編號:cin>>number2;employee::display();}intnumb2(){returnnumber2;}};//.

.classsalesman:publicemployee//售員類{protected:inttotal;intboss;intnumber3;public:voiddisplay3(){cout<<"銷售員的編號:cin>>number3;employee::display();cout<<"銷售額:cin>>total;cout<<"所屬銷售經(jīng)理的編號:cin>>boss;}inthismanager(){returnboss;}intxiaoshoue(){returntotal;}intnumb3(){returnnumber3;}};

//classsalesmanager:publicmanager//售經(jīng)理類{protected:intnumber4;public:voiddisplay4(){.

.cout<<"銷售經(jīng)理的編號:cin>>number4;employee::display();}intnumb4(){returnnumber4;}};//voidform(){cout<<"★★小型公司工資管理系統(tǒng)★★"<<endl;//示表格cout<<"┌─────────────┐"<<endl;cout<<"│cout<<"│cout<<"│cout<<"│cout<<"│cout<<"│

請選擇您所需的操作│"<<endl;數(shù)據(jù)輸入:并按回車鍵│"<<endl;數(shù)據(jù)統(tǒng)計(jì):并按回車鍵│"<<endl;數(shù)據(jù)打?。翰椿剀囨I│"<<endl;數(shù)據(jù)備份:并按回車鍵│"<<endl;退出系統(tǒng):并按回車鍵│"<<endl;cout<<"└─────────────┘"<<endl;cout<<"請選擇一個(gè)操作:";}intmain(){inti,j,k,g,m,all,t;charshuzi;intwage[N];.

.techniciant1[N];managerm1[N];salesmans1[2*N],s2[2*N];salesmanagersm1[N],f;for(t=1;;t++){form();cin>>shuzi;switch(shuzi){case'1':{//功能for(i=0;i<N;i++)t1[i].display1();cout<<"......................................."<<endl;for(i=0;i<N;i++)m1[i].display2();cout<<"......................................."<<endl;for(i=0;i<2*N;i++)s1[i].display3();cout<<"......................................."<<endl;for(i=0;i<N;i++)sm1[i].display4();cout<<"......................................."<<endl;break;}case'2'://功能.

.for(i=0;i<N;i++){wage[i]=5000;all=0;cout<<"工號"<<sm1[i].numb4()<<"售經(jīng)"<<sm1[i].nam()<<"下屬銷售員的業(yè)績?yōu)椋?<<endl;cout<<"┌─────┬────┬─────┐cout<<"│職工號│姓名│銷售額│"<<endl;for(m=0;m<2*N;m++){if(s1[m].hismanager()==sm1[i].numb4()){wage[i]=wage[i]+0.005*(s1[m].xiaoshoue());all=all+s1[m].xiaoshoue();cout<<"├─────┼────┼─────┤cout<<"│"<<setw(10)<<s1[m].numb3()<<"│"<<setw(8)<<s1[m].nam()<<"│"<<setw(10)<<s1[m].xiaoshoue()<<"}}cout<<"├─────┼────┴─────┤cout<<"│銷售額總計(jì)│"<<setw(20)<<all<<""<<endl;cout<<"└─────┴──────────┘for(j=0;j<N;j++)for(k=0;k<N-j;k++)if(wage[k]<wage[k+1]){t=wage[k];//泡wage[k]=wage[k+1];wage[k+1]=t;f=sm1[k];sm1[k]=sm1[k+1];sm1[k+1]=f;}.

.cout<<"銷售經(jīng)理按工資排序?yàn)椋?<<endl;cout<<"┌─────┬────┬────┬────┬────┐cout<<"│職工號│姓名│性別│年齡│工資│"<<endl;for(g=0;g<N;g++){cout<<"├─────┼────┼────┼────┼────┤cout<<""<<setw(10)<<sm1[g].numb4()<<""<<setw(8)<<sm1[g].nam()<<"│"<<setw(8)<<sm1[g].se()<<"│"<<setw(8)<<sm1[g].ag()<<"│"<<setw(8)<<wage[g]<<"│"<<endl;}cout<<"└─────┴────┴────┴────┴────┘break;//能3case'3':cout<<"請等待............"<<endl;cout<<"職工基本情況一覽表如下<<endl;cout<<"技術(shù)員"<<endl;cout<<"┌─────┬────┬────┬────┬────┐"<<endl;cout<<"│職工號│姓名│性別│年齡│工資│"<<endl;for(i=0;i<N;i++){cout<<"├────┼────┼────┼────┼────┤"<<endl;cout<<"│"<<setw(10)<<t1[i].numb1()<<"

│"<<setw(8)<<t1[i].nam()<<"

│"<<setw(8)<<t1[i].se()<<"

│"<<setw(8)<<t1[i].ag()<<"│"<<setw(8)<<t1[i].time()*100<<"}cout<<"└─────────┴────┴────┴────┘.

."<<endl;//技術(shù)員表cout<<"......................................................."<<endl;cout<<"經(jīng)理"<<endl;cout<<"┌─────┬────┬────┬────┬────┐"<<endl;cout<<"│職工號│姓名│性別│年齡│工資│"<<endl;for(i=0;i<N;i++){cout<<"├─────┼────┼────┼────┼────┤"<<endl;cout<<"│"<<setw(10)<<m1[i].numb2()<<"

│"<<setw(8)<<m1[i].nam()<<"

│"<<setw(8)<<m1[i].se()<<"

│"<<setw(8)<<m1[i].ag()<<"│"<<setw(8)<<"8000"<<""<<endl;}cout<<"└─────┴────┴────┴────┴────┘"<<endl;//經(jīng)理表cout<<"......................................................."<<endl;cout<<"銷售經(jīng)理"<<endl;cout<<"┌─────┬────┬────┬────┬────┐"<<endl;cout<<"│職工號│姓名│性別│年齡│工資│"<<endl;for(g=0;g<N;g++){.

.cout<<"├─────┼────┼────┼────┼────┤"<<endl;

cout<<"│"<<setw(10)<<sm1[g].numb4()<<"

│"<<setw(8)<<sm1[g].nam()<<"

│"<<setw(8)<<sm1[g].se()<<"

│"<<setw(8)<<sm1[g].ag()<<"│"<<setw(8)<<wage[g]<<""<<endl;}cout<<"└─────┴────┴────┴────┴────┘"<<endl;cout<<"......................................................."<<endl;//銷售經(jīng)理表cout<<"銷售員"<<endl;cout<<"┌─────┬────┬────┬────┬────┬────────┐"<<endl;cout<<"│職工號│姓名│性別│年齡│工資│所屬部門經(jīng)理編號│"<<endl;for(i=0;i<(2*N);i++){cout<<"├────┼────┼────┼────┼────┼────────┤"<<endl;cout<<"│"<<setw(10)<<s1[i].numb3()<<"

│"<<setw(8)<<s1[i].nam()<<"

│"<<setw(8)<<s1[i].se()<<"

│"<<setw(8)<<s1[i].ag()<<"│"<<setw(8)<<s1[i].xiaoshoue()*0.04<<"│"<<setw(16)<<s1[i].hismanager()<<"│"<<endl;}cout<<"└────┴────┴────┴────┴────┴────────┘"<<endl;//經(jīng)理表cout<<"...........................................................

......................"<<endl;break;case'4':cout<<"數(shù)據(jù)備份"<<endl;outfile.open("E:\\sjq.txt",ios::in|ios::out|ios::trunc);outfile<<"技術(shù)員"<<endl;outfile<<"┌─────┬───┬────┬────┬────┐"<<endl;outfile<<"│職工號│姓名│性別│年齡│工資│"<<endl;for(i=0;i<N;i++){outfile<<"─┼────┼────┼────┼────┤"<<endl;outfile<<"│"<<setw(10)<<t1[i].numb1()<<"

│"<<setw(8)<<t1[i].nam()<<"

│"<<setw(8)<<t1[i].se()<<"

│"<<setw(8)<<t1[i].ag()<<"│"<<setw(8)<<t1[i].time()*100<<"}outfile<<"└─────┴────┴────┴────┴────┘"<<endl;//技術(shù)員表outfile<<"......................................................."<<endl;outfile<<"經(jīng)理"<<endl;outfile<<"┌─────┬────┬───┬────┬────┐"<<endl;outfile<<"│職工號│姓名│性別│年齡│工資│"<<endl;for(i=0;i<N;i++).

.{outfile<<"────┼────┼────┼────┼────┤"<<endl;outfile<<"│"<<setw(10)<<m1[i].numb2()<<"

│"<<setw(8)<<m1[i].nam()<<"

│"<<setw(8)<<m1[i].se()<<"

│"<<setw(8)<<m1[i].ag()<<"│"<<setw(8)<<"8000"<<""<<endl;}outfile<<"└─────┴────┴────┴────┴────┘"<<endl;//經(jīng)理表outfile<<"......................................................."<<endl;outfile<<"銷售經(jīng)理"<<endl;outfile<<"┌─────┬───┬────┬────┬────┐"<<endl;outfile<<"│職工號│姓名│性別│年齡│工資│"<<endl;for(g=0;g<N;g++){outfile<<"├───────┼────┼────┼────┤"<<endl;outfile<<"│"<<setw(10)<<sm1[g].numb4()<<"

│"<<setw(8)<<sm1[g].nam()<<"

│"<<setw(8)<<sm1[g].se()<<"

│"<<setw(8)<<sm1[g].ag()<<"│"<<setw(8)<<wage[g]<<""<<endl;}outfile<<"└─────┴───┴────┴────┴────┘"<<endl;outfile<<"........................................................

."<<endl;//銷售經(jīng)理表outfile<<"銷售員"<<endl;outfile<<"┌─────┬───┬────┬────┬────┬────────┐"<<endl;outfile<<"│職工號│姓名│性別│年齡│工資│所屬部門經(jīng)理編號│"<<endl;for(i=0;i<(2*N);i++){outfile<<"├─────┼────┼────┼────┼────┼────────┤"<<endl;outfile<<"│"<<setw(10)<<s1[i].numb3()<<"

│"<<setw(8)<<s1[i].nam()<<"

│"<<setw(8)<<s1[i].se()<<"

│"<<setw(8)<<s1[i].ag()<<"│"<<setw(8)<<s1[i].xiaoshoue()*0.04<<"│"<<setw(16)<<s1[i].hismanager()<<"│"<<endl;}outfile<<"────┴────┴────┴────┴────┴────────┘"<<endl;//經(jīng)理表outfile<<"..............................................................................."<<endl;outfile.close();break;case'5':cout<<"確定退出系統(tǒng)嗎?"<<endl;cout<<"是:1,

否:2"<<endl;inta;cin>>a;if(a==1)exit(5);break;default:cout<<"error"<<endl;}.

.}return0;}.

.四、運(yùn)行結(jié)果.

..

..

.數(shù)據(jù)備份內(nèi)容…………….

..

.五、程序的使用說明1.從鍵盤輸入1,按回車鍵,可進(jìn)行各類數(shù)據(jù)的輸入,此步驟必須執(zhí)行;2.從鍵盤輸入2,按回車鍵,即可進(jìn)行數(shù)據(jù)統(tǒng)計(jì),得到統(tǒng)計(jì)列表;3.從鍵盤輸入3,按回車鍵,可打印出各類成員的基本信息;4.從鍵盤輸入4,按回車鍵,可進(jìn)行數(shù)據(jù)備份;5.從鍵盤輸入5,按回車鍵,出現(xiàn)提示信息,若退出系統(tǒng)輸入否則輸入2。.

.六、總結(jié)及心得體會從9月2號,我們開始了為期一周C++程序設(shè)計(jì)實(shí)習(xí)——《小型工資管理系統(tǒng)每天下午去機(jī)房調(diào)試程序,上午編寫下一天的程序代碼。剛開始的時(shí)候袋里一點(diǎn)思路都沒有以前沒有接觸過這么大的程序。所以剛開始的時(shí)候心里只有一個(gè)字能形容就是怕怕自己便不好怕這門課程

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論