歡迎來到裝配圖網(wǎng)! | 幫助中心 裝配圖網(wǎng)zhuangpeitu.com!
裝配圖網(wǎng)
ImageVerifierCode 換一換
首頁 裝配圖網(wǎng) > 資源分類 > DOC文檔下載  

C++課程設(shè)計(jì) 職工工資管理系統(tǒng)(報(bào)告內(nèi)含程序完整清單)

  • 資源ID:50491569       資源大?。?span id="ycdo55j" class="font-tahoma">509.50KB        全文頁數(shù):27頁
  • 資源格式: DOC        下載積分:18積分
快捷下載 游客一鍵下載
會(huì)員登錄下載
微信登錄下載
三方登錄下載: 微信開放平臺登錄 支付寶登錄   QQ登錄   微博登錄  
二維碼
微信掃一掃登錄
下載資源需要18積分
郵箱/手機(jī):
溫馨提示:
用戶名和密碼都是您填寫的郵箱或者手機(jī)號,方便查詢和重復(fù)下載(系統(tǒng)自動(dòng)生成)
支付方式: 支付寶    微信支付   
驗(yàn)證碼:   換一換

 
賬號:
密碼:
驗(yàn)證碼:   換一換
  忘記密碼?
    
友情提示
2、PDF文件下載后,可能會(huì)被瀏覽器默認(rèn)打開,此種情況可以點(diǎn)擊瀏覽器菜單,保存網(wǎng)頁到桌面,就可以正常下載了。
3、本站不支持迅雷下載,請使用電腦自帶的IE瀏覽器,或者360瀏覽器、谷歌瀏覽器下載即可。
4、本站資源下載后的文檔和圖紙-無水印,預(yù)覽文檔經(jīng)過壓縮,下載后原文更清晰。
5、試題試卷類文檔,如果標(biāo)題沒有明確說明有答案則都視為沒有答案,請知曉。

C++課程設(shè)計(jì) 職工工資管理系統(tǒng)(報(bào)告內(nèi)含程序完整清單)

真誠為您提供優(yōu)質(zhì)參考資料,若有不當(dāng)之處,請指正。目錄目錄i1概述11.1程序的基本功能11.2其它功能11.3擴(kuò)展功能12課題的分析22.1會(huì)員登入系統(tǒng)模塊即systemhead靜態(tài)全局函數(shù)模塊22.2查詢功能模塊即search函數(shù)模塊22.3職務(wù)信息匹配及處理模塊即systembody靜態(tài)全局函數(shù)模塊模塊422.4循環(huán)控制模塊即while(1)模塊23詳細(xì)設(shè)計(jì)33.1類聲明33.2系統(tǒng)簡略流程圖43.3會(huì)員登入系統(tǒng)模塊即systemhead靜態(tài)全局函數(shù)模塊53.4查詢功能模塊即search函數(shù)模塊63.5職務(wù)信息匹配及處理模塊即systembody靜態(tài)全局函數(shù)模塊73.6循環(huán)控制模塊即while(1)模塊74課程設(shè)計(jì)總結(jié)84.1完成情況84.2遇到的問題及解決8參考文獻(xiàn)11附錄1226 / 271 概述本課程設(shè)計(jì)是面向?qū)ο蟪绦蛟O(shè)計(jì)課程的后繼教學(xué)環(huán)節(jié),學(xué)好C+語言就必須堅(jiān)持用面向?qū)ο蟮乃季S方式分析問題、解決問題,最好的方法是仿照教材編寫C+實(shí)際應(yīng)用程序。此次課程設(shè)計(jì)的題目及要求:實(shí)現(xiàn)一個(gè)簡單的工資管理系統(tǒng)。1.1 程序的基本功能系統(tǒng)的主要功能是計(jì)算職工當(dāng)月工資并存檔。公司內(nèi)有5種不同類型的職工:技術(shù)人員、銷售人員、文秘、技術(shù)經(jīng)理和銷售經(jīng)理,他們的工資計(jì)算方式各不相同。1.2 其它功能將工資信息存入salary.txt文件中,工資信息包含雇員編號、姓名、職務(wù)、月份、月收入。Info.txt文件中只存留一些信息及會(huì)員最后進(jìn)入系統(tǒng)時(shí)輸入的數(shù)據(jù),最多含有編號、姓名、職務(wù)、月份的信息。1.3 擴(kuò)展功能采用了會(huì)員制度,并將登入信息及編號、密碼存入number.txt文件中。2 課題的分析通過對課題的深入分析,我將這個(gè)課題分為以下幾個(gè)模塊,深入詳細(xì)得剖析它們。2.1 會(huì)員登入系統(tǒng)模塊即systemhead靜態(tài)全局函數(shù)模塊程序運(yùn)行后,先進(jìn)行會(huì)員選擇判斷。為減少會(huì)員重新注冊,通過輸入兩次編號及密碼,增加繁瑣度。同時(shí)在一定的方面上,又方便忘記密碼的會(huì)員。通過密碼匹配,雇員的工資信息這一隱私得到了很好的保障。2.2 查詢功能模塊即search函數(shù)模塊首先,從info.txt中提取編號,與salary.txt中的編號進(jìn)行匹配,匹配成功,輸出工資信息,直到文件!indata.eof()=0。.2.3 職務(wù)信息匹配及處理模塊即systembody靜態(tài)全局函數(shù)模塊模塊4從info.txt中提取職務(wù)信息,用switch語句進(jìn)行匹配,據(jù)匹配情況調(diào)用不同的函數(shù)進(jìn)行輸入、處理、顯示并以增加方式記錄到salary.txt中。2.4 循環(huán)控制模塊即while(1)模塊為了更加方便使用,盡量改善系統(tǒng),實(shí)現(xiàn)search函數(shù)及systembody函數(shù)功能,在search函數(shù)及systembody函數(shù)模塊的基礎(chǔ)上加了一些必要的語句,并增加了外層循環(huán)控制。3 詳細(xì)設(shè)計(jì)作為一個(gè)面向?qū)ο蟪绦蛟O(shè)計(jì),我們不得不先從類的聲明開始設(shè)計(jì),而后是一個(gè)整體的流程圖做框架。最后在從小的模塊結(jié)構(gòu)著手。class TechManager:public Technician, public Managerprivate:float gradeBonus;int grade;public:TechManager(float x=1000);void setgrade(float x);void countSalary( );圖3.1 類聲明3.1 類聲明圖3.2 職工工資管理系統(tǒng)簡略流程圖3.2 系統(tǒng)簡略流程圖開始優(yōu)點(diǎn):一個(gè)入口,一個(gè)出口!處理5輸入5輸入4輸入3輸入2輸入1處理4處理3處理2處理1工資記錄在salary.txt職務(wù)代碼分析顯示真10查詢信息選擇?是否會(huì)員否注冊是輸入編號及密碼假檢驗(yàn)?真輸入姓名、職務(wù)、月份記錄編碼姓名職務(wù)月份至info.txt從info.txt提取職務(wù)代碼再次輸入假結(jié)束3.3 會(huì)員登入系統(tǒng)模塊即systemhead靜態(tài)全局函數(shù)模塊清空info.txt并將編號存入到info.txt中圖3.3 登入系統(tǒng)模塊詳細(xì)流程圖否是否會(huì)員輸入編號及密碼打開name.txt并輸出編號及密碼匹配?關(guān)閉name.txt否是以增加方式打開name.txt并輸入編號及密碼關(guān)閉name.txt.輸入編號及密碼3.4 查詢功能模塊即search函數(shù)模塊10否是輸出info.txt中的職務(wù)信息將info.txt的編號與salary.txt中的編號進(jìn)行匹配是否打開info.txt!indata.eof() ?圖3.4 查詢功能模塊以默認(rèn)方式打開info.txt以默認(rèn)方式打開salary.txt從文件info.txt中提取編號并關(guān)閉文件輸出“以上是你的工資信息!”關(guān)閉salary.txt3.5 職務(wù)信息匹配及處理模塊即systembody靜態(tài)全局函數(shù)模塊圖3.5 systembody函數(shù)模塊以默認(rèn)方式打開info.txt提取info.txt中的職務(wù)信息switch語句進(jìn)行職務(wù)匹配調(diào)用不同函數(shù)進(jìn)行數(shù)據(jù)處理及顯示3.6 循環(huán)控制模塊即while(1)模塊圖3.6循環(huán)控制模塊即while(1)模塊102輸入選擇操作查詢功能模塊Info及recordinfo調(diào)用systembody調(diào)用選擇?結(jié)束4 課程設(shè)計(jì)總結(jié)4.1 完成情況本次面向?qū)ο笳n程設(shè)計(jì)的所有功能基本完成,并且擴(kuò)展功能也成功的實(shí)現(xiàn)!可執(zhí)行文件能正常執(zhí)行指令并運(yùn)行!4.2 遇到的問題及解決圖4.2.1錯(cuò)誤Error C:Users權(quán)Desktopmain.o(.data$_vt$8Employee+0xc):main.cpp: undefined reference to Employee:countSalary(void)'錯(cuò)誤:沒有定義Employee類中的countSalary函數(shù)!改正:將原先的“virtual void countSalary();”改為” virtual void countSalary()”圖4.2.2錯(cuò)誤錯(cuò)誤分析:(會(huì)員板塊中)提示:“數(shù)字1表示是!其他鍵表示否!”,但定義的選擇變量為整型。加上我當(dāng)時(shí)輸入字符p。改正:“其他鍵表示否!”改為”數(shù)字0表示否”。輸入時(shí)按提示進(jìn)行輸入即可!圖4.2.3錯(cuò)誤調(diào)試分析:錯(cuò)誤發(fā)生在systemhead靜態(tài)全局函數(shù)內(nèi)的文件輸入循環(huán)模塊中!改正:將以nocreate方式即” ifstream indata("d:number.txt",ios:nocreate); “ 該為默認(rèn)打開方式即“ifstream indata("d:number.txt");”。圖4.2.4錯(cuò)誤調(diào)試分析:錯(cuò)誤發(fā)生在調(diào)用systembody靜態(tài)全局函數(shù)前后的while循環(huán)模塊中,很有可能是數(shù)據(jù)存取混亂造成的。改正: systemhead靜態(tài)全局函數(shù)內(nèi)“ofstream outdata("d:info.txt",ios:trunc);”改為先清后在以默認(rèn)方式輸入!且將存取整型編號的變量類型從字符型改為整型。圖4.2.5錯(cuò)誤錯(cuò)誤:后面莫名其妙的跟著一個(gè)提示語句指令。分析調(diào)試:當(dāng)語句指令是基類info函數(shù)內(nèi)的語句,很有可能是循環(huán)控制出現(xiàn)了一些問題。改正:見程序源代碼!參考文獻(xiàn)1 下面給出幾個(gè)參考文獻(xiàn)的格式參考2 匿名,不知道,非常多計(jì)算機(jī)實(shí)用教程北京:XX大學(xué)出版社,2004,1232343 美 Donis SomethingVisual X# 2008技術(shù)內(nèi)幕北京:YYY大學(xué)出版社,2007,56784 Johns Smith, James Nothing. Programming in C+ or Anything and Something. http:/www.world.ic.ac.uk/lab/cplusplus/nothing/index.html 20075 Anonymous. Something to Say. 20076 面向?qū)ο蟪绦蛟O(shè)計(jì) ,鄭莉,清華大學(xué)出版社, 7 面向?qū)ο蟪绦蛟O(shè)計(jì)C+語言,朱戰(zhàn)立等編 西安電子科技大學(xué)出版社8 面向?qū)ο蟪绦蛟O(shè)計(jì)-Visual C+,劉斌等編, 清華大學(xué)出版社 9 面向?qū)ο蟪绦蛟O(shè)計(jì)-C+語言描述, Richard Johnsonbaugh(美)等著,蔡宇輝等譯,機(jī)械工業(yè)出版社, 2003附錄本系統(tǒng)有三個(gè)源程序文件構(gòu)成,分別為system.h, system.cpp及main.cpp。同時(shí)含有三個(gè)系統(tǒng)文件,分別為info.txt, name.txt及salary.txt,且全部存放在D盤根目錄下,請勿隨意移動(dòng)或修改系統(tǒng)文件。當(dāng)會(huì)員正式進(jìn)入系統(tǒng), info.txt是先清空后用來存儲會(huì)員輸入的信息,最多含有編號、姓名、職務(wù)及月份。當(dāng)僅會(huì)員注冊時(shí),會(huì)將編碼及密碼存儲到name.txt中。當(dāng)僅會(huì)員登入的編號及密碼進(jìn)行匹配時(shí),會(huì)打開輸入文件name.txt,提取編號及密碼,進(jìn)行匹配。當(dāng)僅當(dāng)輸入工資數(shù)據(jù)時(shí),會(huì)將工資、編號、姓名、職務(wù)、月份存儲到salary.txt中。當(dāng)僅當(dāng)查詢工資信息時(shí),會(huì)打開salary.txt,提取編號、姓名、職務(wù)、月份及工資。該系統(tǒng)是一個(gè)只適合5種及5種職務(wù)的工資管理系統(tǒng)。并將職務(wù)分為技術(shù)人員、銷售人員、文秘、技術(shù)經(jīng)理和銷售經(jīng)理,其代號分別為1,2,3,4,5。雇員編號以整型變量存儲,編號所取范圍在-65536至65535之內(nèi)(包括邊界值),首位數(shù)字表示相應(yīng)的職務(wù)代碼。該系統(tǒng)能力有限,請根據(jù)指示嚴(yán)格輸入相應(yīng)字符!程序清單Main 函數(shù)#include "system.cpp"#include "cstring"static void systemhead();static void systembody(); static void technician();static void salesman();static void secretary();static void techmanager();static void salesmanager();using namespace std;void main()systemhead(); /調(diào)用systemhead靜態(tài)全局函數(shù) cout<<"nn1: 查詢工資"cout<<"nn2: 輸入工資數(shù)據(jù)"cout<<"nn0: 退出系統(tǒng)!nn"cout<<"請選擇您需要的操作!n"while(1) int xuanze; cin>>xuanze; if(xuanze=1) employee a; cout<<endl<<endl; a.search(); cout<<"nn輸入工資數(shù)據(jù)請按數(shù)字2,退出系統(tǒng)請按數(shù)字0!nn" /查詢工資信息 if(xuanze=2) employee a; a.info(); a.recordinfo(); /輸入處理工資數(shù)據(jù)并暫時(shí)記錄 systembody(); /調(diào)用systembody靜態(tài)全局函數(shù) cout<<"nn查詢工資請按數(shù)字1,退出系統(tǒng)請按數(shù)字0!nn" if(xuanze=0)exit(0); static void salesmanager()SalesManager a5;float sum;cout<<"請輸入整個(gè)月的總營業(yè)額:"cin>>sum;a5.setsalesnum(sum);a5.countSalary();a5.recordSalary();static void techmanager()TechManager a4;int gra;cout<<"請輸入這個(gè)月的評級:" /1,2,3三個(gè)等級 cin>>gra;a4.setgrade(gra);a4.countSalary();a4.recordSalary();static void secretary()Secretary a3;float bon;cout<<"請輸入這個(gè)月的額外獎(jiǎng)勵(lì):"cin>>bon;a3.setbonus(bon);a3.countSalary();a3.recordSalary();static void salesman()Salesman a2;float sum;cout<<"請輸入整個(gè)月的營業(yè)額:"cin>>sum;a2.setsalesnum(sum);a2.countSalary();a2.recordSalary();static void technician()Technician a1;float hour;cout<<"請輸入整個(gè)月的工作時(shí)間:"cin>>hour;a1.setHour(hour);a1.countSalary();a1.recordSalary();static void systembody()ifstream indata("info.txt");if(indata=NULL) exit(0);int num;char na25;int sta;indata>>num>>na>>sta; /職務(wù)代號分別為1,2,3,4,5 switch(sta)case 1:technician();break;case 2:salesman();break;case 3:secretary();break; case 4:techmanager();break; case 5:salesmanager();break;default:cout<<"職務(wù)代號錯(cuò)誤!n請重新輸入!"static void systemhead()char x,y='y'int num;char secret6;while(y) cout<<"nn系統(tǒng)會(huì)員請輸入'y',非系統(tǒng)會(huì)員請輸入nn" cin>>x; if(x) cout<<"請輸入編號(首位為職務(wù)代號且為不超過5位數(shù)的整數(shù)):n" cin>>num; cout<<"請輸入密碼(6及6位字符以下):n" cin>>secret; /輸入編號及密碼 ifstream indata("number.txt"); if(indata=NULL) cout<<"文件打開失??!請聯(lián)系管理員!n" exit(0); /文件沒打開,退出程序 int num1;char secret16; indata>>num1; while(!indata.eof() indata>>secret1;if(num=num1)&&(strcmp(secret,secret1)=0)y=0; /改變判斷變量的值,停止外層循環(huán) break; /終止內(nèi)層循環(huán) indata>>num1; indata.close(); / 檢驗(yàn) 登入信息 else cout<<"請輸入編號(首位為職務(wù)代號且為不超過5位數(shù)的整數(shù)):n" cin>>num; cout<<"請輸入密碼(6及6位字符以下):n" cin>>secret; /注冊輸入編號及密碼ofstream outdata("number.txt",ios:app);outdata<<num<<'t'<<secret<<'t'outdata.close(); /將編號及密碼保存到number.txt中cout<<endl<<endl; ofstream outdata("info.txt",ios:trunc); outdata.close(); /清空文件內(nèi)容 ofstream outdata1("info.txt");outdata1<<num<<'t'outdata.close(); /輸入編號至info.txt System.cpp#include <iostream>#include <fstream>#include "system.h"using namespace std;void Employee:info()char na25;int sta,mon;cout<<"請依次輸入姓名、職務(wù)代號及月份(以空格符分隔):" cin>>na>>sta>>mon;name=na;status=sta;month=mon; /存儲姓名、職務(wù)、月份 void Employee:search()int num;ifstream indata0("info.txt");if(indata0=NULL) exit(0);indata0>>num;indata0.close(); /從文件info.txt中提取編號 int num1;char na125;int sta1;int mon1;float sal;int mon0;ifstream indata("salary.txt");if(indata=NULL) exit(0);while(!indata.eof()indata>>num1>>na1>>sta1>>mon1>>sal;if(num=num1)cout<<num1<<'t'<<na1<<'t'<<sta1<<'t'<<mon1<<'t'<<sal<<'n' /依次輸出該雇員的工資信息 if(indata.eof() cout<<"nn以上是你的工資信息!nn" indata.close();void Employee:recordinfo()ofstream outdata("info.txt",ios:app);outdata<<name<<'t'<<status<<'t'<<month;outdata.close(); /添加姓名、職務(wù)、月份至存有編號的info.txt中 void Employee:recordSalary()ifstream indata("info.txt");indata>>number>>name>>status>>month;indata.close(); /依次輸出該雇員的工資信息 int num1;char na125;int sta1;int mon1;float sal;ifstream indata1("salary.txt");if(indata1=NULL) exit(0);while(!indata1.eof()indata1>>num1>>na1>>sta1>>mon1>>sal;if(month!=mon1)cout<<num1<<'t'<<na1<<'t'<<sta1<<'t'<<mon1<<'t'<<sal<<'n'else exit(0); /依次輸出該雇員的工資信息 cout<<number<<'t'<<name<<'t'<<status<<'t'<<month<<'t'<<salary; /顯示工資信息ofstream outdata("salary.txt",ios:app);outdata<<'n'<<number<<'t'<<name<<'t'<<status<<'t'<<month<<'t'<<salary;outdata.close(); void Technician:setHour(float x)workHour=x;Technician:Technician(float x)hourSalary=x;void Technician:countSalary()salary=workHour*hourSalary;void Salesman:setsalesnum(float x) salesnum=x;Salesman:Salesman(float x)getRate=x;void Salesman:countSalary( )salary=salesnum*getRate;void Secretary:setbonus(float x) bonus=x;Secretary:Secretary(float x)fixedSalary=x;void Secretary:countSalary( )salary=fixedSalary+bonus;Manager:Manager(float x)fixedSalary=x;void TechManager:setgrade(int x)grade=x;TechManager:TechManager(float x)gradeBonus=x;void TechManager:countSalary()salary=fixedSalary+grade*gradeBonus;SalesManager:SalesManager(float x)getRate=x;void SalesManager:countSalary()salary=fixedSalary+salesnum*getRate;void Technician:setHour(float x)workHour=x;Technician:Technician(float x)hourSalary=x;void Technician:countSalary()salary=workHour*hourSalary;void Salesman:setsalesnum(float x) salesnum=x;Salesman:Salesman(float x)getRate=x;void Salesman:countSalary( )salary=salesnum*getRate;void Secretary:setbonus(float x) bonus=x;Secretary:Secretary(float x)fixedSalary=x;void Secretary:countSalary( )salary=fixedSalary+bonus;Manager:Manager(float x)fixedSalary=x;void TechManager:setgrade(int x)grade=x;TechManager:TechManager(float x)gradeBonus=x;void TechManager:countSalary()salary=fixedSalary+grade*gradeBonus;SalesManager:SalesManager(float x)getRate=x;void SalesManager:countSalary()salary=fixedSalary+salesnum*getRate;System.hclass Employeeprotected:int number; char name25; int status;int month; float salary;public:void info(); void search();virtual void countSalary()void recordinfo(); void recordinfo1();void recordSalary();class Salesman:public Employee protected:float salesnum;double getRate;public:Salesman(float x=0.05);void setsalesnum(float x);void countSalary( );class Technician:public Employeeprivate:float workHour; float hourSalary;public:Technician(float x=35.0); void setHour(float x);void countSalary( );class Secretary:public Employeeprivate:float fixedSalary;float bonus;public:Secretary(float x=4000);void setbonus(float x);void countSalary( );class Managerprotected:float fixedSalary;public:Manager(float x=6000);void countSalary( );class SalesManager:public Salesman, public Managerpublic:SalesManager(float x=0.02);void countSalary( );class TechManager:public Technician, public Managerprivate:float gradeBonus;int grade;public:TechManager(float x=1000);void setgrade(int x);void countSalary( );

注意事項(xiàng)

本文(C++課程設(shè)計(jì) 職工工資管理系統(tǒng)(報(bào)告內(nèi)含程序完整清單))為本站會(huì)員(優(yōu)***)主動(dòng)上傳,裝配圖網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對上載內(nèi)容本身不做任何修改或編輯。 若此文所含內(nèi)容侵犯了您的版權(quán)或隱私,請立即通知裝配圖網(wǎng)(點(diǎn)擊聯(lián)系客服),我們立即給予刪除!

溫馨提示:如果因?yàn)榫W(wǎng)速或其他原因下載失敗請重新下載,重復(fù)下載不扣分。




關(guān)于我們 - 網(wǎng)站聲明 - 網(wǎng)站地圖 - 資源地圖 - 友情鏈接 - 網(wǎng)站客服 - 聯(lián)系我們

copyright@ 2023-2025  zhuangpeitu.com 裝配圖網(wǎng)版權(quán)所有   聯(lián)系電話:18123376007

備案號:ICP2024067431-1 川公網(wǎng)安備51140202000466號


本站為文檔C2C交易模式,即用戶上傳的文檔直接被用戶下載,本站只是中間服務(wù)平臺,本站所有文檔下載所得的收益歸上傳人(含作者)所有。裝配圖網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對上載內(nèi)容本身不做任何修改或編輯。若文檔所含內(nèi)容侵犯了您的版權(quán)或隱私,請立即通知裝配圖網(wǎng),我們立即給予刪除!