小型公司工資管理系統(tǒng)C實(shí)習(xí)_第1頁(yè)
小型公司工資管理系統(tǒng)C實(shí)習(xí)_第2頁(yè)
小型公司工資管理系統(tǒng)C實(shí)習(xí)_第3頁(yè)
小型公司工資管理系統(tǒng)C實(shí)習(xí)_第4頁(yè)
小型公司工資管理系統(tǒng)C實(shí)習(xí)_第5頁(yè)
已閱讀5頁(yè),還剩17頁(yè)未讀 繼續(xù)免費(fèi)閱讀

下載本文檔

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

文檔簡(jiǎn)介

1、中國(guó)石油大學(xué)(華東)信息與控制工程學(xué)院程序設(shè)計(jì)實(shí)習(xí)報(bào)告小型公司工資管理系統(tǒng)的設(shè)計(jì)與實(shí)現(xiàn)專業(yè)班級(jí):電氣12級(jí)4班學(xué)號(hào):120534xx姓名:xxx起止日期:20指導(dǎo)老師:董超群 2013年7月27日 目錄一、 實(shí)習(xí)內(nèi)容1 1.1、課程設(shè)計(jì)的目的1 1.2、設(shè)計(jì)題目及要求1二、 設(shè)計(jì)思路2三、 程序清單43.1、程序源代碼4四、 運(yùn)行結(jié)果134.1、程序運(yùn)行144.2、備份文本信息15五、 程序使用說(shuō)明16六、 總結(jié)及心得體會(huì)17三、程序清單#include <iostream>#include <string>#include <cstdlib>#includ

2、e <fstream>#include<iomanip>using namespace std;const int A=1,B=2,C=1,D=1;/定義全局常變量int n=0;int m2=0,0;int t2;/以下是5個(gè)類的設(shè)計(jì)class Staff/雇員類(基類) public: void data_cin()/成員函數(shù) cout<<"其姓名:"cin>>name; cout<<"性別(m/w):"cin>>sex; cout<<"年齡:"c

3、in>>age; int turn_num() return num; string turn_name() return name; char turn_sex() return sex; int turn_age() return age; protected: int num; string name; int age; char sex; int pay;class Technician:public Staff/技術(shù)員類(雇員類派生類) public: void data_cin() cout<<"技術(shù)員的編號(hào):"cin>>nu

4、m; Staff:data_cin(); cout<<"工作時(shí)間:"cin>>time; int turn_pay1() return 100*time; protected: int time;class Salesman:public Staff/銷售員類(雇員類派生類) public: Salesman()sales_money=0; void data_cin() cout<<"銷售員的編號(hào):"cin>>num; Staff:data_cin(); cout<<"銷售額:&qu

5、ot;cin>>sales_money; cout<<"所屬銷售經(jīng)理的編號(hào):"cin>>belong; pay=sales_money*0.04; int turn_sales_money() return sales_money; int turn_belong() return belong; int turn_pay2() return sales_money*0.04; protected: int sales_money; int belong;class Manager:public Staff/經(jīng)理類(雇員類派生類) pub

6、lic: void data_cin() cout<<"經(jīng)理的編號(hào):"cin>>num; Staff:data_cin(); pay=8000; int turn_pay3() return 8000; ;class Salesmanager:public Manager/銷售經(jīng)理類(經(jīng)理類派生類) public: int turn_num() return num; void data_cin() cout<<"銷售經(jīng)理的編號(hào):"cin>>num; Staff:data_cin(); ;/以下是對(duì)象或?qū)ο?/p>

7、數(shù)組的定義Technician TA;Manager MB;Salesman SC;Salesmanager SMD;/有關(guān)函數(shù)的聲明和定義void fun1();void qian();void zhong();void hou();void fun1()cout<<"-"<<endl;void qian()cout<<""<<endl;cout<<" 職工號(hào) 姓名 性別 年齡 工資 "<<endl;void zhong()cout<<"&

8、quot;<<endl;void hou()cout<<""<<endl;double wageD;/工資計(jì)算方法double SM_wage(Salesman S,Salesmanager SM)int i,j,k;double p;Salesmanager q;for(k=0;k<D;k+) wagek=0; for(i=0;i<D;i+)double sum=0; for(j=0;j<C;j+) if(SMi.turn_num()=Sj.turn_belong()sum+=Sj.turn_sales_money()

9、; wagei=sum*0.005+5000; for(i=0;i<D-1;i+) for(j=0;j<D-1-i;j+) if(wagej<wagej+1)p=wagej+1;wagej+1=wagej;wagej=p; q=SMj+1;SMj+1=SMj;SMj=q; return 0;/以下是主函數(shù)int main()int flag=1,operate;docout<<" 小型公司工資管理系統(tǒng)n"cout<<" n"cout<<" 請(qǐng)選擇您所需的操作 n"cout<&

10、lt;" 數(shù)據(jù)輸入:1,并按回車鍵 n"cout<<" 數(shù)據(jù)統(tǒng)計(jì):2,并按回車鍵 n"cout<<" 數(shù)據(jù)打?。?,并按回車鍵 n"cout<<" 數(shù)據(jù)備份:4,并按回車鍵 n"cout<<" 退出系統(tǒng):5,并按回車鍵 n"cout<<" n"cout<<" 請(qǐng)選擇一個(gè)操作: "cin>>operate;switch(operate)case 1:/在此添加代碼,完成數(shù)據(jù)輸

11、入功能cout<<"請(qǐng)輸入數(shù)據(jù):"<<endl;cout<<"正在輸入數(shù)據(jù)."<<endl;fun1(); int i; for(i=0;i<A;i+)Ti.data_cin();cout<<endl; fun1(); for(i=0;i<B;i+)Mi.data_cin();cout<<endl; fun1(); for(i=0;i<C;i+)Si.data_cin();cout<<endl; fun1(); for(i=0;i<D;i+)SMi

12、.data_cin();cout<<endl; fun1();break;case 2:/在此添加代碼,完成數(shù)據(jù)統(tǒng)計(jì)功能cout<<"請(qǐng)等待."<<endl;cout<<"正在進(jìn)行數(shù)據(jù)統(tǒng)計(jì)."<<endl;int i,j; for(i=0;i<D;i+)cout<<"職工號(hào)為"<<SMi.turn_num()<<"銷售經(jīng)理"<<SMi.turn_name()<<"下屬銷售員的業(yè)績(jī)?yōu)?/p>

13、:"<<endl; cout<<""<<endl; cout<<" 職工號(hào) 姓名 銷售額 "<<endl; for(j=0;j<C;j+) if(Sj.turn_belong()=SMi.turn_num()cout<<""<<endl; cout<<""<<setw(12)<<Sj.turn_num()<<""<<setw(12)<

14、;<Sj.turn_name()<<""<<setw(12)<<Sj.turn_sales_money()<<""<<endl; mi+=Sj.turn_sales_money(); cout<<""<<endl; cout<<"銷售額總計(jì) "<<setw(20)<<mi<<" "<<endl; cout<<""&l

15、t;<endl; cout<<"銷售經(jīng)理排序?yàn)椋?quot;<<endl; qian(); SM_wage(S,SM); for(i=0;i<D;i+)zhong(); cout<<""<<setw(6)<<SMi.turn_num()<<" "<<setw(6)<<SMi.turn_name()<<" "<<setw(6)<<SMi.turn_sex()<<"

16、 "<<setw(6)<<SMi.turn_age()<<" "<<setw(6)<<wagei<<" "<<endl; hou();break;case 3:/在此添加代碼,完成數(shù)據(jù)打印功能cout<<"請(qǐng)等待."<<endl;cout<<"正在進(jìn)行數(shù)據(jù)打印."<<endl;SM_wage(S,SM);int i; cout<<"請(qǐng)稍等"&l

17、t;<endl; cout<<"職工基本情況一覽表如下:"<<endl; cout<<"技術(shù)員"<<endl; qian(); for(i=0;i<A;i+)zhong(); cout<<""<<setw(6)<<Ti.turn_num()<<" "<<setw(6)<<Ti.turn_name()<<" "<<setw(6)<<

18、Ti.turn_sex()<<" "<<setw(6)<<Ti.turn_age()<<" "<<setw(6)<<Ti.turn_pay1()<<" "<<endl;hou();fun1();cout<<"經(jīng)理"<<endl;qian();for(i=0;i<B;i+)zhong();cout<<""<<setw(6)<<Mi.tur

19、n_num()<<" "<<setw(6)<<Mi.turn_name()<<" "<<setw(6)<<Mi.turn_sex()<<" "<<setw(6)<<Mi.turn_age()<<" "<<setw(6)<<Mi.turn_pay3()<<" "<<endl;hou();fun1();cout<<&quo

20、t;銷售經(jīng)理"<<endl;qian();for(i=0;i<D;i+)zhong();cout<<""<<setw(6)<<SMi.turn_num()<<" "<<setw(6)<<SMi.turn_name()<<" "<<setw(6)<<SMi.turn_sex()<<" "<<setw(6)<<SMi.turn_age()<&l

21、t;" "<<setw(6)<<wagei<<" "<<endl;hou();fun1();cout<<"銷售員"<<endl;cout<<""<<endl;cout<<" 職工號(hào) 姓名 性別 年齡 工資 所屬部門經(jīng)理編號(hào)"<<endl;for(i=0;i<C;i+)cout<<""<<endl; cout<<&qu

22、ot;"<<setw(6)<<Si.turn_num()<<" "<<setw(6)<<Si.turn_name()<<" "<<setw(6)<<Si.turn_sex()<<" "<<setw(6)<<Si.turn_age()<<" "<<setw(6)<<Si.turn_pay2()<<" "<

23、<setw(10)<<Si.turn_belong()<<" "<<endl;cout<<""<<endl;fun1();break;case 4:/在此添加代碼,完成數(shù)據(jù)備份功能cout<<"請(qǐng)等待."<<endl;cout<<"正在進(jìn)行數(shù)據(jù)備份."<<endl; SM_wage(S,SM); int i;ofstream outfile;outfile.open("工資管理系統(tǒng).txt&q

24、uot;,ios:out); outfile<<"職工基本情況一覽表如下:"<<'n'<<endl; outfile<<"技術(shù)員"<<endl;outfile<<""<<endl;outfile<<" 職工號(hào) 姓名 性別 年齡 工資 "<<endl;for(i=0;i<A;i+)outfile<<""<<endl;outfile<<

25、""<<setw(6)<<Ti.turn_num()<<" "<<setw(6)<<Ti.turn_name()<<" "<<setw(6)<<Ti.turn_sex()<<" "<<setw(6)<<Ti.turn_age()<<" "<<setw(6)<<Ti.turn_pay1()<<" "&

26、lt;<endl;outfile<<""<<endl;outfile<<"-"<<endl;outfile<<"經(jīng)理"<<endl;outfile<<""<<endl;outfile<<" 職工號(hào) 姓名 性別 年齡 工資 "<<endl;for(i=0;i<B;i+)outfile<<""<<endl;outfile<

27、;<""<<setw(6)<<Mi.turn_num()<<" "<<setw(6)<<Mi.turn_name()<<" "<<setw(6)<<Mi.turn_sex()<<" "<<setw(6)<<Mi.turn_age()<<" "<<setw(6)<<Mi.turn_pay3()<<" &q

28、uot;<<endl; outfile<<""<<endl; outfile<<"-"<<endl; outfile<<"銷售經(jīng)理"<<endl;outfile<<""<<endl;outfile<<" 職工號(hào) 姓名 性別 年齡 工資 "<<endl; for(i=0;i<D;i+)outfile<<""<<endl;outfile<<""<<setw(6)<<SMi.turn_num()<<" "<<setw(6)<<SMi.turn_name()<<" "<<setw(6)<<SMi.turn_sex()<<" "<<setw(6)<<SMi.turn_age()<&

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(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ì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論