汽車汽修管理系統(tǒng)c課程設(shè)計(jì)模板_第1頁
汽車汽修管理系統(tǒng)c課程設(shè)計(jì)模板_第2頁
汽車汽修管理系統(tǒng)c課程設(shè)計(jì)模板_第3頁
汽車汽修管理系統(tǒng)c課程設(shè)計(jì)模板_第4頁
汽車汽修管理系統(tǒng)c課程設(shè)計(jì)模板_第5頁
已閱讀5頁,還剩61頁未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

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

文檔簡(jiǎn)介

汽車汽修管理系統(tǒng)c課程設(shè)計(jì)資料內(nèi)容僅供參考,如有不當(dāng)或者侵權(quán),請(qǐng)聯(lián)系本人改正或者刪除。目錄一、設(shè)計(jì)題目 1二、設(shè)計(jì)目的 1三、設(shè)計(jì)說明 1四、總體設(shè)計(jì) 2五、詳細(xì)設(shè)計(jì) 3六、結(jié)論 7七、附錄(程序源代碼): 7設(shè)計(jì)題目汽車汽修管理系統(tǒng) 二、設(shè)計(jì)目的1.經(jīng)過課程設(shè)計(jì)掌握面向?qū)ο蟮某绦蛟O(shè)計(jì)思路。2.經(jīng)過課程設(shè)計(jì)掌握類的繼承、抽象類、多態(tài)、虛基類的應(yīng)用方法。3.經(jīng)過課程設(shè)計(jì)掌握C++中對(duì)文件進(jìn)行查找、刪除、修改等操作方法。三、設(shè)計(jì)說明系統(tǒng)功能需求描述本系統(tǒng)主要實(shí)現(xiàn)車輛信息、車輛修理單信息的插入、刪除及查詢等功能。編程實(shí)現(xiàn)汽車汽修管理系統(tǒng),主要汽車汽修管理系統(tǒng)。其中車輛信息應(yīng)該包括車牌號(hào)、牌號(hào)、型號(hào)、生產(chǎn)廠家、修理項(xiàng)目碼、修理日期、修理項(xiàng)目、修理小時(shí)數(shù)、完工日期。車輛修理菜單信息包括修理單編號(hào)、修理工工號(hào)、修理日期、修理項(xiàng)目、修理小時(shí)數(shù)、完工日期。具體功能如下:(1)用戶登錄界面設(shè)計(jì)。(2)信息維護(hù):包括車輛信息維護(hù):增加車輛信息、刪除車輛信息、膝蓋車輛信息。包括車輛修理單信息維護(hù):增加車輛修理單信息、刪除和良修理單信息、修改車輛修理單信息。(3)信息查詢:對(duì)車輛信息查詢時(shí)可實(shí)現(xiàn)按車輛名查詢、按車主名查詢等多條件查詢。對(duì)車輛修理單信息查詢時(shí)可實(shí)現(xiàn)按車輛修理單號(hào)查詢、按修理工工號(hào)查詢等多條件查詢。(4)修理單統(tǒng)計(jì):按月統(tǒng)計(jì)輸出上的汽車修理單信息。按月統(tǒng)計(jì)每個(gè)修理工的月修理信息。2.系統(tǒng)運(yùn)行環(huán)境(1)硬件環(huán)境。本系統(tǒng)適用于那種Inter386以上計(jì)算機(jī),內(nèi)存容量為128M,應(yīng)配備鍵盤、鼠標(biāo)、顯示器等外部設(shè)備。(2)軟件環(huán)境。本系統(tǒng)的設(shè)計(jì)采用VisualC++6.0編寫。在WindowsXPSP2環(huán)境下測(cè)試經(jīng)過。四、總體設(shè)計(jì)1.數(shù)據(jù)設(shè)計(jì)(1)類設(shè)計(jì)車輛信息類car_infor,該類有共同的信息車牌號(hào)car_no、牌號(hào)car_brand、型號(hào)car_modles、生產(chǎn)廠家manufacturer、修理項(xiàng)目碼repair_code、車主姓名owner_name、聯(lián)系電話phone_nomber、修理日期repair_time。車輛修理菜單信息類repair_list,該類有共同的修理單編號(hào)list_no、修理工工號(hào)repaiman_no、修理日期repair_time、修理項(xiàng)目project、修理小時(shí)數(shù)repair_hours、完工日期complete_time。用戶信息類user,該類有成員用戶名user_name、密碼password。功能類fun,該類中包含所有的功能函數(shù),實(shí)現(xiàn)對(duì)車輛信息及車輛修理單信息的增加、修改、刪除以及統(tǒng)計(jì)等實(shí)用功能。voidadd()增加車輛信息,voiddel()刪除車輛信息,voidmodify()修改車輛信息,voidadd_list()增加車輛修理單信息,voiddel_list()刪除車輛修理單信息,voidmodify_list()修改車輛修理單信息,intJudge()判斷函數(shù),voidquery_car()查詢車輛信息,voidquery_list()查詢車輛修理單信息,voidquery_car_no()按車輛名查詢,voidquery_owner_name()按車主名查詢,voidquery_repaiman_no()按修理工工號(hào)查詢,voidquery_rlist_no()按車輛修理單號(hào)查詢,Statistics()修理單統(tǒng)計(jì)等。(2)函數(shù)設(shè)計(jì)Intregiste()用戶注冊(cè),intJudge6()用戶登錄,voidadd()增加車輛信息,voiddel()刪除車輛信息,voidadd_list()增加車輛修理單信息,voidmodify()修改車輛信息,voiddel_list()刪除車輛修理單信息,voidmodify_list()修改車輛修理單信息,intJudge()判斷函數(shù),voidquery_car()查詢車輛信息,voidquery_list()查詢車輛修理單信息,voidquery_car_no()按車輛名查詢,voidquery_owner_name()按車主名查詢,voidquery_repaiman_no()按修理工工號(hào)查詢,voidquery_rlist_no()按車輛修理單號(hào)查詢,voidStatistics()1按月輸出汽車修理單信息,voidStatistics()2統(tǒng)計(jì)每個(gè)修理工的月修理信息。結(jié)構(gòu)設(shè)計(jì)系統(tǒng)流程圖如圖4-1所示。圖4-1系統(tǒng)流程圖五、詳細(xì)設(shè)計(jì)(1)用戶登錄/注冊(cè)界面設(shè)計(jì)圖5-1用戶登錄界面此界面用戶經(jīng)過選擇進(jìn)行登錄、注冊(cè)操作,經(jīng)過調(diào)用函數(shù)registe(),Judge6()實(shí)現(xiàn)相關(guān)功能。(2)汽車汽修管理系統(tǒng)界面圖5-2汽車汽修管理系統(tǒng)界面經(jīng)過用戶選擇相關(guān)功能進(jìn)行操作,由menu()函數(shù)實(shí)現(xiàn)顯示功能,用戶根據(jù)相關(guān)提示進(jìn)入下一步。(3)增加車輛信息圖5-3增加車輛信息用戶按照提示輸入,進(jìn)入相關(guān)調(diào)用及選擇如圖中調(diào)用add()函數(shù)實(shí)現(xiàn)對(duì)數(shù)據(jù)的增加操作。(4).刪除車輛信息圖5-4刪除車輛信息此界面實(shí)現(xiàn)對(duì)信息的刪除操作,調(diào)用del()函數(shù),實(shí)現(xiàn)中先判斷有無此信息,然后進(jìn)行相關(guān)操作。(5)修改車輛信息圖5-5修改車輛信息此界面調(diào)用了modify()函數(shù),系統(tǒng)先判斷有無此信息,然后用戶根據(jù)提示,找到數(shù)據(jù),進(jìn)行修改操作。(6)查詢車輛信息圖5-6查詢車輛信息此界面調(diào)用query_car()函數(shù),此函數(shù)包含其它兩函數(shù)工能,因此用戶根據(jù)提示選擇自己的查詢方式。(7)統(tǒng)計(jì)車輛修理單信息圖5-7統(tǒng)計(jì)車輛修理單信息此界面調(diào)Statistics()函數(shù),此函數(shù)包含其它兩函數(shù)工能,因此用戶根據(jù)提示選擇相關(guān)需要統(tǒng)計(jì)。六、結(jié)論這次做的是汽車汽修管理系統(tǒng),能夠很好的實(shí)現(xiàn)對(duì)相關(guān)信息的增加、刪除、修改、查詢以及用戶的注冊(cè)、登錄等功能。而且還能夠?qū)崿F(xiàn)相關(guān)功能間的循環(huán)轉(zhuǎn)換,本次開發(fā)主要用了c++中對(duì)于類以及文件的使用,大部分功能的實(shí)現(xiàn)依靠文件的相關(guān)控制。因此在實(shí)現(xiàn)和代碼上有許多值得改進(jìn)和的地方。由于時(shí)間原因,程序功能相關(guān)部分,還有許多地方值得推敲和拓展開發(fā)。開發(fā)過程中,由于是開發(fā)者單獨(dú)的設(shè)計(jì)和編寫,因此在某些功能上可能與實(shí)際的需求有出入,主要是在技術(shù)上和需求分析上問題,因此該系統(tǒng)還是有尚需要改進(jìn)的部分??赡芤?yàn)闀r(shí)間的原因,有些地方做得不夠精細(xì),所學(xué)的東西不能全部用好。多多把所學(xué)的運(yùn)用到實(shí)際中是以后的編程中應(yīng)該加強(qiáng)和注意的。七、附錄(程序源代碼):#include<iostream>#include<string>#include<fstream>#include<sstream>#include<iomanip>#include<stdio.h>usingnamespacestd;//****車輛信息類****classcar_infor{public: car_infor() {}private: stringcar_no;//車牌號(hào) stringcar_brand;//牌號(hào) stringcar_modles;//型號(hào) stringmanufacturer;//生產(chǎn)廠家 stringrepair_code;//修理項(xiàng)目碼 stringowner_name;//車主姓名 stringphone_number;//聯(lián)系電話 stringrepair_time;//修理日期};//****修理單類****classrepair_list{public: repair_list() {}private: stringlist_no;//修理單編號(hào) stringrepairman_no;//修理工工號(hào) stringrepair_time;//修理日期 stringproject;//修理項(xiàng)目 stringrepair_hours;//修理小時(shí)數(shù) stringcomplete_time;//完工日期};//****用戶信息類****classuser{public: user() {}private: stringuser_name;//用戶名 stringpassword;//密碼};//****功能類****classfun{public: fun() {}//**********信息維護(hù)************//****增加車輛信息**** voidadd() { system("cls"); stringa,b,c,d,e,f,g,h; stringline; ofstreamcar("d:\\cars.txt",ios::app); if(!car) { cerr<<"openerror!"<<endl; exit(1); } intflag=1; while(flag) { cout<<endl<<endl; cout<<"\t\t\t*****************"<<endl; cout<<"\t\t\t1.增加汽車信息"<<endl<<endl; cout<<"\t\t\t0.返回上一菜單"<<endl; cout<<"\t\t\t*****************"<<endl; cout<<"\t\t\t請(qǐng)輸入您的選擇:"; intn; cin>>n; switch(n) { case1: system("cls"); cout<<endl; cout<<"\t請(qǐng)按提示輸入車輛信息:"<<endl<<endl; cout<<"\t車牌號(hào):"; cin>>a; cout<<endl; cout<<"\t汽車的牌號(hào):"; cin>>b; cout<<endl; cout<<"\t汽車的型號(hào):"; cin>>c; cout<<endl; cout<<"\t生產(chǎn)廠家:"; cin>>d; cout<<endl; cout<<"\t修理項(xiàng)目碼:"; cin>>e; cout<<endl; cout<<"\t車主姓名:"; cin>>f; cout<<endl; cout<<"\t聯(lián)系電話:"; cin>>g; cout<<endl; cout<<"\t修理日期:"; cin>>h; cout<<endl; car<<setiosflags(ios::left)<<a<<''<<b<<''<<c<<''<<d<<''<<e<<''<<f<<''<<g<<''<<h<<endl; system("cls"); cout<<endl<<"\t\t信息錄入完成!!!"<<endl<<endl; system("pause");break; case0:flag=0;system("cls");break; default:system("cls");cout<<endl<<endl<<endl<<"\t\t\t輸入錯(cuò)誤!請(qǐng)重新輸入!"; } } car.close(); } //***判斷函數(shù)*** intJudge1(stringcar_n,stringline) { ifstreamcar("d:\\cars.txt"); stringa,b,c,d,e,f,g,h; while(getline(car,line)) { istringstreamis(line); is>>a>>b>>c>>d>>e>>f>>g>>h; if(car_n==a) { return1; } } return0; } //****刪除車輛信息**** voiddel() { system("cls"); stringa,b,c,d,e,f,g,h; stringline; stringcar_no; ifstreamcar("d:\\cars.txt"); if(!car) { cerr<<"cars.txtcan'topen!"<<endl; exit(1); } ofstreamtemp("d:\\temp.txt"); if(!temp) { cerr<<"temp.txtcan'topen!"<<endl; exit(1); } intflag=1; while(flag) { cout<<endl<<endl; cout<<"\t\t\t*****************"<<endl; cout<<"\t\t\t1.刪除車輛信息"<<endl<<endl; cout<<"\t\t\t0.返回上一菜單"<<endl; cout<<"\t\t\t*****************"<<endl; cout<<"\t\t\t請(qǐng)輸入您的選擇:"; intflag1=1; intn; cin>>n; switch(n) { case1: { stringcar_n; cout<<endl; cout<<"\t\t\t請(qǐng)輸入要?jiǎng)h除的車輛的車牌號(hào):"; cin>>car_n; if(Judge1(car_n,line)==1) { system("cls"); cout<<endl<<endl<<endl; cout<<"\t\t存在這輛汽車,確定要?jiǎng)h除?(Y/N)"<<endl<<endl; cout<<"\t\t請(qǐng)輸入您的選擇:"<<endl; cout<<"\t\t"; charch; cin>>ch; switch(ch) { case'Y': while(getline(car,line)&&flag1) { stringa,b,c,d,e,f,g,h; stringline; stringcar_n; stringcar_no; cout<<"\t\t請(qǐng)?jiān)俅屋斎胍獎(jiǎng)h除的車輛的車牌號(hào):"<<endl; cout<<"\t\t"; cin>>car_n; ifstreamcar("d:\\cars.txt"); ofstreamtemp("d:\\tem.txt"); while(getline(car,line)) { istringstreamis(line); is>>a>>b>>c>>d>>e>>f>>g>>h; if(!car) { cout<<"您要的信息不存在"; } if(car_n!=a) { temp<<setiosflags(ios::left)<<a<<''<<b<<''<<c<<''<<d<<''<<e<<''<<f<<''<<g<<''<<h<<endl; } } ofstreamcar1("d:\\cars.txt",ios::trunc); ifstreamtemp1("d:\\tem.txt"); while(getline(temp1,line)) { istringstreamis(line); is>>a>>b>>c>>d>>e>>f>>g>>h; car1<<setiosflags(ios::left)<<setw(20)<<a<<''<<b<<''<<c<<''<<d<<''<<e<<''<<f<<''<<g<<''<<h<<endl; } ofstreamtemp2("d:\\tem.txt",ios::trunc); temp2.close(); car.close(); car1.close(); temp.close(); temp1.close(); system("cls"); cout<<endl<<endl<<"\t\t\t信息已成功刪除!"<<endl<<endl; flag1=0; };break; case'N':system("cls");continue;break; default:system("cls");cout<<endl<<endl<<endl<<"\t\t\t輸入錯(cuò)誤!請(qǐng)重新輸入!";//++++++++++++++++ } } else { system("cls"); cout<<endl<<endl<<"\t\t\t沒有這輛車的信息!!!"<<endl<<endl; break; } };break; case0:flag=0;break; default:system("cls");cout<<endl<<endl<<endl<<"\t\t\t輸入錯(cuò)誤!請(qǐng)重新輸入!"; } } car.close(); temp.close(); }//****修改車輛信息**** voidmodify() { system("cls"); stringa,b,c,d,e,f,g,h; stringline; stringcar_n; cout<<endl; ifstreamcar("d:\\cars.txt"); if(!car) { cerr<<"cars.txtcan'topen!"<<endl; exit(1); } ofstreamtemp("d:\\tem.txt"); if(!temp) { cerr<<"tem.txtcan'topen!"<<endl; exit(1); } intflag=1,flag1=1; while(flag) { cout<<endl<<endl; cout<<"\t\t\t*****************"<<endl; cout<<"\t\t\t1.修改車輛信息"<<endl<<endl; cout<<"\t\t\t0.返回上一菜單"<<endl; cout<<"\t\t\t*****************"<<endl; cout<<"\t\t\t請(qǐng)輸入您的選擇:"; intn; cin>>n; switch(n) { case1: { stringcar_n; cout<<endl; cout<<"\t\t\t請(qǐng)輸入要修改的汽車號(hào)碼:"<<endl; cout<<"\t\t\t"; cin>>car_n; if(Judge1(car_n,line)==1) { system("cls"); cout<<endl<<endl<<endl; cout<<"\t\t存在這輛汽車,確定修改?(Y/N)"<<endl; cout<<"\t\t請(qǐng)輸入您的選擇:"<<endl; cout<<"\t\t"; charch; cin>>ch; switch(ch) { case'Y': while(getline(car,line)&&flag1) { stringa,b,c,d,e,f,g,h; stringline; stringcar_n; stringcar_no; cout<<"\t\t請(qǐng)?jiān)俅屋斎胍薷牡能囕v的車牌號(hào):"<<endl; cout<<"\t\t"; cin>>car_n; ifstreamcar("d:\\cars.txt"); ofstreamtemp("d:\\tem.txt"); while(getline(car,line)) { istringstreamis(line); is>>a>>b>>c>>d>>e>>f>>g>>h; if(!car) { cout<<"您要的信息不存在"; } if(car_n!=a) { temp<<setiosflags(ios::left)<<a<<''<<b<<''<<c<<''<<d<<''<<e<<''<<f<<''<<g<<''<<h<<endl; } } ofstreamcar1("d:\\cars.txt",ios::trunc); ifstreamtemp1("d:\\tem.txt"); while(getline(temp1,line)) { istringstreamis(line); is>>a>>b>>c>>d>>e>>f>>g>>h; car1<<setiosflags(ios::left)<<setw(20)<<a<<''<<b<<''<<c<<''<<d<<''<<e<<''<<f<<''<<g<<''<<h<<endl; } ofstreamtemp2("d:\\tem.txt",ios::trunc); temp2.close(); temp.close(); temp1.close(); system("cls"); cout<<endl; cout<<"\t\t請(qǐng)按提示重新輸入車輛信息:"<<endl<<endl; cout<<"\t\t車牌號(hào):"; cin>>a; cout<<endl; cout<<"\t\t汽車的牌號(hào):"; cin>>b; cout<<endl; cout<<"\t\t汽車的型號(hào):"; cin>>c; cout<<endl; cout<<"\t生產(chǎn)廠家:"; cin>>d; cout<<endl; cout<<"\t修理項(xiàng)目碼:"; cin>>e; cout<<endl; cout<<"\t車主姓名:"; cin>>f; cout<<endl; cout<<"\t聯(lián)系電話:"; cin>>g; cout<<endl; cout<<"\t修理日期:"; cin>>h; cout<<endl; car1<<setiosflags(ios::left)<<a<<''<<b<<''<<c<<''<<d<<''<<e<<''<<f<<''<<g<<''<<h<<endl; system("cls"); cout<<endl<<"\t\t新信息錄入完成!!!"<<endl<<endl; system("pause");break; car.close(); car1.close(); flag1=0; };break; case'N':system("cls");continue;break; default:system("cls");cout<<endl<<endl<<endl<<"\t\t\t輸入錯(cuò)誤!請(qǐng)重新輸入!";//++++++++++++++++ } } else { system("cls"); cout<<endl<<endl<<"\t\t\t沒有該輛車的信息!!!"<<endl<<endl; break; } };break; case0:flag=0;break; default:system("cls");cout<<endl<<endl<<endl<<"\t\t\t輸入錯(cuò)誤!請(qǐng)重新輸入!"; } } car.close(); temp.close(); } //****增加車輛修理單信息**** voidadd_list() { system("cls"); stringa,b,c,d,e,f; stringline; ofstreamcar_list("d:\\cars_list.txt",ios::app); if(!car_list) { cerr<<"openerror!"<<endl; exit(1); } intflag=1; while(flag) { cout<<endl<<endl; cout<<"\t\t\t*****************"<<endl; cout<<"\t\t\t1.增加車輛修理單信息"<<endl<<endl; cout<<"\t\t\t0.返回上一菜單"<<endl; cout<<"\t\t\t*****************"<<endl; cout<<"\t\t\t請(qǐng)輸入您的選擇:"; intn; cin>>n; switch(n) { case1: system("cls"); cout<<endl; cout<<"\t請(qǐng)按提示輸入車輛修理單信息:"<<endl<<endl; cout<<"\t修理單編號(hào):"; cin>>a; cout<<endl; cout<<"\t修理工工號(hào):"; cin>>b; cout<<endl; cout<<"\t修理日期:"; cin>>c; cout<<endl; cout<<"\t修理項(xiàng)目:"; cin>>d; cout<<endl; cout<<"\t修理小時(shí)數(shù):"; cin>>e; cout<<endl; cout<<"\t完工日期:"; cin>>f; cout<<endl; car_list<<setiosflags(ios::left)<<a<<''<<b<<''<<c<<''<<d<<''<<e<<''<<f<<endl; system("cls"); cout<<endl<<"\t\t修理單信息錄入完成!!!"<<endl<<endl; system("pause");break; case0:flag=0;system("cls");break; default:system("cls");cout<<endl<<endl<<endl<<"\t\t\t輸入錯(cuò)誤!請(qǐng)重新輸入!"; } } car_list.close(); } //***判斷函數(shù)*** intJudge2(stringlist_n,stringline) { ifstreamlist("d:\\cars_list.txt"); stringa,b,c,d,e,f; while(getline(list,line)) { istringstreamis(line); is>>a>>b>>c>>d>>e>>f; if(list_n==a) { return1; } }return0; } //****刪除車輛修理單信息**** voiddele_list() { system("cls"); stringa,b,c,d,e,f; stringline; stringlist_no; ifstreamcar_list("d:\\cars_list.txt"); if(!car_list) { cout<<endl<<endl<<endl; cerr<<"\t\t\tcar_list.txtcan'topen!"; exit(1); } ofstreamtemp("d:\\tem.txt"); if(!temp) { cerr<<"tem.txtcan'topen!"<<endl; exit(1); } intflag=1; while(flag) { cout<<endl<<endl; cout<<"\t\t\t*****************"<<endl; cout<<"\t\t\t1.刪除車輛修理單信息"<<endl<<endl; cout<<"\t\t\t0.返回上一菜單"<<endl; cout<<"\t\t\t*****************"<<endl; cout<<"\t\t\t請(qǐng)輸入您的選擇:"; intflag1=1; intn; cin>>n; switch(n) { case1: { stringlist_n; cout<<endl; cout<<"\t\t\t請(qǐng)輸入要?jiǎng)h除的修理單編號(hào):"<<endl; cout<<"\t\t\t"; cin>>list_n; if(Judge2(list_n,line)==1) { system("cls"); cout<<endl<<endl<<endl; cout<<"\t\t存在這張修理單,確定要?jiǎng)h除?(Y/N)"<<endl<<endl; cout<<"\t\t請(qǐng)輸入您的選擇:"<<endl; cout<<"\t\t"; charch; cin>>ch; switch(ch) { case'Y': while(getline(car_list,line)&&flag1) { stringa,b,c,d,e,f; stringline; stringlist_n; cout<<"\t\t請(qǐng)?jiān)俅屋斎胍獎(jiǎng)h除的修理單編號(hào):"<<endl; cout<<"\t\t"; cin>>list_n; ifstreamcar_list("d:\\cars_list.txt");//cout<<car.rdbuf(); ofstreamtemp("d:\\temp.txt"); while(getline(car_list,line)) { istringstreamis(line); is>>a>>b>>c>>d>>e>>f; if(!car_list) { cout<<"您要的信息不存在"; } if(list_n!=a) { temp<<setiosflags(ios::left)<<a<<''<<b<<''<<c<<''<<d<<''<<e<<''<<f<<endl; } } ofstreamcar_list1("d:\\d:\\cars_list.txt",ios::trunc); ifstreamtemp1("d:\\temp.txt"); while(getline(temp1,line)) { istringstreamis(line); is>>a>>b>>c>>d>>e>>f; car_list1<<setiosflags(ios::left)<<a<<''<<b<<''<<c<<''<<d<<''<<e<<''<<f<<endl; } ofstreamtemp2("d:\\temp.txt",ios::trunc); temp2.close(); car_list1.close(); car_list.close(); temp.close(); temp1.close(); system("cls"); cout<<endl<<endl<<"\t\t\t信息已成功刪除!"<<endl<<endl; flag1=0; };break; case'N':system("cls");continue;break; default:system("cls");cout<<endl<<endl<<endl<<"\t\t\t輸入錯(cuò)誤!請(qǐng)重新輸入!"; } } else { system("cls"); cout<<endl<<endl<<"\t\t\t沒有這修理單的信息!!!"<<endl<<endl; break; } };break; case0:flag=0;break; default:system("cls");cout<<endl<<endl<<endl<<"\t\t\t輸入錯(cuò)誤!請(qǐng)重新輸入!"; } } car_list.close(); temp.close(); } //****修改車輛修理單信息**** voidmodify_list() { system("cls"); stringa,b,c,d,e,f,g; stringline; stringcar_n; cout<<endl; ifstreamcar("d:\\cars_list.txt"); if(!car) { cerr<<"cars_list.txtcan'topen!"<<endl; exit(1); } ofstreamtemp("d:\\temp.txt"); if(!temp) { cerr<<"temp.txtcan'topen!"<<endl; exit(1); } intflag=1,flag1=1; while(flag) { cout<<endl<<endl; cout<<"\t\t\t*****************"<<endl; cout<<"\t\t\t1.修改修理單信息"<<endl<<endl; cout<<"\t\t\t0.返回上一菜單"<<endl; cout<<"\t\t\t*****************"<<endl; cout<<"\t\t\t請(qǐng)輸入您的選擇:"; intn; cin>>n; switch(n) { case1: { stringcar_n; cout<<endl; cout<<"\t\t\t請(qǐng)輸入要修改的修理單編號(hào):"<<endl; cout<<"\t\t\t"; cin>>car_n; if(Judge2(car_n,line)==1) { system("cls"); cout<<endl<<endl<<endl; cout<<"\t\t存在這修理單,確定修改?(Y/N)"<<endl<<endl; cout<<"\t\t請(qǐng)輸入您的選擇:"<<endl; cout<<"\t\t"; charch; cin>>ch; switch(ch) { case'Y': while(getline(car,line)&&flag1) { stringa,b,c,d,e,f,g; stringline; stringcar_n; stringcar_no; cout<<"\t\t請(qǐng)?jiān)俅屋斎胍薷牡男蘩韱翁?hào):"<<endl; cout<<"\t\t"; cin>>car_n; ifstreamcar("d:\\cars_list.txt"); ofstreamtemp("d:\\temp.txt"); while(getline(car,line)) { istringstreamis(line); is>>a>>b>>c>>d>>e>>f>>g; if(!car) { cout<<"您要的信息不存在"; } if(car_n!=a) { temp<<setiosflags(ios::left)<<a<<''<<b<<''<<c<<''<<d<<''<<e<<''<<f<<endl; } } ofstreamcar1("d:\\cars_list.txt",ios::trunc); ifstreamtemp1("d:\\temp.txt"); while(getline(temp1,line)) { istringstreamis(line); is>>a>>b>>c>>d>>e>>f>>g; car1<<setiosflags(ios::left)<<a<<''<<b<<''<<c<<''<<d<<''<<e<<''<<f<<endl; } ofstreamtemp2("d:\\tem.txt",ios::trunc); temp2.close(); temp.close(); temp1.close(); system("cls"); cout<<endl; cout<<"\t請(qǐng)按提示重新輸入修理單信息:"<<endl<<endl; cout<<"\t修理單編號(hào):"; cin>>a; cout<<endl; cout<<"\t汽修理工工號(hào):"; cin>>b; cout<<endl; cout<<"\t修理日期:"; cin>>c; cout<<endl; cout<<"\t修理項(xiàng)目:"; cin>>d; cout<<endl; cout<<"\t修理小時(shí)數(shù):"; cin>>e; cout<<endl; cout<<"\t完工日期:"; cin>>f; cout<<endl; car1<<setiosflags(ios::left)<<a<<''<<b<<''<<c<<''<<d<<''<<e<<''<<f<<endl; system("cls"); cout<<endl<<"\t\t新信息錄入完成!!!"<<endl<<endl; system("pause");break; car.close(); car1.close(); flag1=0; };break; case'N':system("cls");continue;break; default:system("cls");cout<<endl<<endl<<endl<<"\t\t\t輸入錯(cuò)誤!請(qǐng)重新輸入!"; } } else { system("cls"); cout<<endl<<endl<<"\t\t\t沒有該輛車的信息!!!"<<endl<<endl; break; } };break; case0:flag=0;break; default:system("cls");cout<<endl<<endl<<endl<<"\t\t\t輸入錯(cuò)誤!請(qǐng)重新輸入!"; } } car.close(); temp.close(); } //*******信息查詢******* //****按車輛名查詢**** voidquery_car_no() { system("cls"); stringa,b,c,d,e,f,g,h; stringline; stringcar_n; stringcar_no; cout<<endl<<endl<<endl; cout<<"\t\t"<<"請(qǐng)輸入要查詢的車輛名:"; cin>>car_n; ifstreamcar("d:\\cars.txt"); if(!car) { cerr<<"cars.txtcan'topen!"<<endl; exit(1); } ofstreamtemp("d:\\tem.txt"); if(!temp) { cerr<<"tem.txtcan'topen!"<<endl; exit(1); } if(Judge1(car_n,line)==1) { while(getline(car,line)) { istringstreamis(line); is>>a>>b>>c>>d>>e>>f>>g>>h; if(car_n==a) { cout<<endl<<endl; cout<<"\t\t車輛信息如下"<<endl; cout<<"\t\t車牌號(hào):"<<a<<endl; cout<<"\t\t牌號(hào):"<<b<<endl; cout<<"\t\t型號(hào):"<<c<<endl; cout<<"\t\t生產(chǎn)廠家:"<<d<<endl; cout<<"\t\t修理項(xiàng)目碼:"<<e<<endl; cout<<"\t\t車主姓名:"<<f<<endl; cout<<"\t\t聯(lián)系電話:"<<g<<endl; cout<<"\t\t修理日期:"<<h<<endl; } } } else cout<<endl<<"\t\t沒有這輛車的信息!!"<<endl; car.close(); temp.close(); system("deld:\\tem.txt"); system("pause"); } //***判斷函數(shù)*** intJudge4(stringcar_n,stringline) { ifstreamcar("d:\\cars.txt"); stringa,b,c,d,e,f,g,h; while(getline(car,line)) { istringstreamis(line); is>>a>>b>>c>>d>>e>>f>>g>>h; if(car_n==f) { return1; } } return0; } //****按車主名查詢**** voidquery_owner_name() { system("cls"); stringa,b,c,d,e,f,g,h; stringline; stringcar_n; stringowner_name; cout<<endl<<endl<<"\t\t"<<"請(qǐng)輸入要查詢的車主名:"; cin>>owner_name; ifstreamcar("d:\\cars.txt"); if(!car) { cerr<<"cars.txtcan'topen!"<<endl; exit(1); } ofstreamtemp("d:\\tem.txt"); if(!temp) { cerr<<"tem.txtcan'topen!"<<endl; exit(1); } if(Judge4(owner_name,line)==1) { while(getline(car,line)) { istringstreamis(line); is>>a>>b>>c>>d>>e>>f>>g>>h; if(owner_name==f) { cout<<endl<<endl; cout<<"\t\t車輛信息如下"<<endl; cout<<"\t\t車牌號(hào):"<<a<<endl; cout<<"\t\t牌號(hào):"<<b<<endl; cout<<"\t\t型號(hào):"<<c<<endl; cout<<"\t\t生產(chǎn)廠家:"<<d<<endl; cout<<"\t\t修理項(xiàng)目碼:"<<e<<endl; cout<<"\t\t車主姓名:"<<f<<endl; cout<<"\t\t聯(lián)系電話:"<<g<<endl; cout<<"\t\t修理日期:"<<h<<endl; } } } else cout<<endl<<"\t\t沒有這輛車的信息!!"<<endl; car.close(); temp.close(); system("deld:\\tem.txt"); system("pause"); } //****車輛信息查詢**** voidquery_car() { system("cls"); intflag=1; while(flag) { system("cls"); intn; cout<<endl<<endl; cout<<"\t\t\t1.按車輛名查詢"<<endl<<endl; cout<<"\t\t\t2.按車主名查詢"<<endl<<endl; cout<<"\t\t\t3.刷新顯示界面"<<endl<<endl; cout<<"\t\t\t0.返回上一菜單"<<endl<<endl; cout<<"\t\t\t請(qǐng)輸入您選擇的查詢方式:"; cin>>n; switch(n) { case1:query_car_no();break; case2:query_owner_name();break; case3:system("cls");break; case0:flag=0;break; default:cout<<"\t輸入錯(cuò)誤!請(qǐng)重新輸入!"<<endl<<endl; } } } //****按車輛修理單號(hào)查詢**** voidquery_rlist_no() { system("cls"); stringa,b,c,d,e,f; stringline; stringlist_no; cout<<endl<<endl<<"\t\t\t請(qǐng)輸入您要查詢的修理單編號(hào):"; cin>>list_no; ifstreamcar_list("d:\\cars_list.txt"); if(!car_list) { cerr<<"cars_list.txtcan'topen!"<<endl; exit(1); } ofstreamtemp("d:\\temp.txt"); if(!temp) { cerr<<"temp.txtcan'topen!"<<endl; exit(1); } if(Judge2(list_no,line)==1) { while(getline(car_list,line)) { istringstreamis(line); is>>a>>b>>c>>d>>e>>f; if(list_no==a) { cout<<endl<<endl; cout<<"\t\t修理單信息如下"<<endl; cout<<"\t\t修理單編號(hào):"<<a<<endl; cout<<"\t\t修理工工號(hào):"<<b<<endl; cout<<"\t\t修理日期:"<<c<<endl; cout<<"\t\t修理項(xiàng)目:"<<d<<endl; cout<<"\t\t修理小時(shí)數(shù):"<<e<<endl; cout<<"\t\t完工日期:"<<f<<endl; } } } else cout<<endl<<"\t\t沒有這張修理單的信息!!"<<endl; car_list.close(); temp.close();; system("deld:\\temp.txt"); system("pause"); } //***判斷函數(shù)*** intJudge3(stringlist_n,stringline) { ifstreamlist("d:\\cars_list.txt"); stringa,b,c,d,e,f; while(getline(list,line)) { istringstreamis(line); is>>a>>b>>c>>d>>e>>f; if(list_n==b) { return1; } }return0; } //****按修理工工號(hào)查詢**** voidquery_repairman_no() { system("cls"); stringa,b,c,d,e,f; stringline; stringrepairman_no; cout<<endl<<endl<<"\t\t\t請(qǐng)輸入修理工工號(hào):"; cin>>repairman_no; ifstreamcar_list("d:\\cars_list.txt"); if(!car_list) { cerr<<"cars_list.txtcan'topen!"<<endl; exit(1); } ofstreamtemp("d:\\temp.txt"); if(!temp) { cerr<<"temp.txtcan'topen!"<<endl; exit(1); } if(Judge3(repairman_no,line)==1) { while(getline(car_list,line)) { istringstreamis(line); is>>a>>b>>c>>d>>e>>f; if(repairman_no==b) { cout<<endl<<endl; cout<<"\t\t修理單信息如下"<<endl; cout<<"\t\t修理單編號(hào):"<<a<<endl; cout<<"\t\t修理工工號(hào):"<<b<<endl; cout<<"\t\t修理日期:"<<c<<endl; cout<<"\t\t修理項(xiàng)目:"<<d<<endl; cout<<"\t\t修理小時(shí)數(shù):"<<e<<endl; cout<<"\t\t完工日期:"<<f<<endl; } } } else cout<<endl<<"\t\t\t沒有這張修理單的信息!!"<<endl; car_list.close(); temp.close();; system("deld:\\temp.txt"); system("pause"); } //******查詢修理單***** voidquery_list() { system("cls"); intflag=1; while(flag) { system("cls"); intn; cout<<endl<<endl; cout<<"\t\t\t1.按修理工工號(hào)查詢"<<endl<<endl; cout<<"\t\t\t2.按修理工工號(hào)查詢"<<endl<<endl; cout<<"\t\t\t3.刷新顯示界面"<<endl<<endl; cout<<"\t\t\t0.返回上一菜單"<<endl<<endl; cout<<"\t\t\t請(qǐng)輸入您選擇的查詢方式:"; cin>>n; switch(n) { case1:query_rlist_no();break; case2:query_repairman_no();break; case3:system("cls");break; case0:flag=0;break; default:cout<<"\t輸入錯(cuò)誤!請(qǐng)重新輸入!"<<endl<<endl; } } } //*****月統(tǒng)計(jì)輸出的汽車修理單信息**** voidStatistics1() { system("cls"); charmonth[2]; strings;charc[10]; stringa,b,d,e,f; stringline; stringrepairman_no; cout<<endl<<endl<<"\t\t\t請(qǐng)輸入修理單的月份:"; cin>>month; ifstreamcar_list("d:\\cars_list.txt"); if(!car_list) { cerr<<"cars_list.txtcan'topen!"<<endl; exit(1); } ofstreamtemp("d:\\temp.txt"); if(!temp) { cerr<<"temp.txtcan'topen!"<<endl; exit(1); } while(getline(car_list,line)) { istringstreamis(line); is>>a>>b>>c>>d>>e>>f; if(*month==*c&&*(month+1)==*(c+1)) { cout<<endl<<endl; cout<<"\t\t修理單信息如下"<<endl; cout<<"\t\t修理單編號(hào):"<<a<<endl; cout<<"\t\t修理工工號(hào):"<<b<<endl; cout<<"\t\t修理日期:"<<c<<endl; cout<<"\t\t修理項(xiàng)目:"<<d<<endl; cout<<"\t\t修理小時(shí)數(shù):"<<e<<endl; cout<<"\t\t完工日期:"<<f<<endl; } } car_list.close(); temp.close(); system("deld:\\temp.txt"); system("pause"); } //****按月統(tǒng)計(jì)每個(gè)修理工的月修理信息**** voidStatistics2() { system("cls"); strings; charc[10],month[2]; stringa,b,d,e,f; stringline; stringrepairman_no; ifstreamcar_list("d:\\cars_list.txt"); if(!car_list) { cerr<<"cars_list.txtcan'topen!"<<endl; exit(1); } ofstreamtemp("d:\\temp.txt"); if(!temp) { cerr<<"temp.txtcan'topen!"<<endl; exit(1); } cout<<endl<<endl<<"\t\t\t請(qǐng)輸入修理工工號(hào):"; cin>>repairman_no; istringstreamis(line); is>>a>>b>>c>>d>>e>>f; if(repairman_no==b) { while(getline(car_list,line)) { istringstreamis(line); is>>a>>b>>c>>d>>e>>f; cout<<endl<<endl<<"\t\t\t請(qǐng)輸入修理單的月份:"; cin>>month; if(*month==*c&&*(month+1)==*(c+1)) { cout<<endl<<endl; cout<<"\t\t修理單信息如下"<<endl; cout<<"\t\t修理單編號(hào):"<<a<<endl; cout<<"\t\t修理工工號(hào):"<<b<<endl; cout<<"\t\t修理日期:"<<c<<endl; cout<<"\t\t修理項(xiàng)目:"<<d<<endl; cout<<"\t\t修理小時(shí)數(shù):"<<e<<endl; cout<<"\t\t完工日期:"<<f<<endl; } else cout<<endl<<endl<<"\t\t\t這個(gè)月沒有此修理工修理單信息!!"<<endl; } } else cout<<endl<<endl<<"\t\t\t沒有此修理工!!"<<endl; car_list.close(); temp.close(); system("deld:\\temp.txt"); system("pause"); } //*******統(tǒng)計(jì)修理單******voidStatistics() { intflag=1; while(flag) { system("cls"); intn; cout<<endl<<endl<<"\t\t\t*****************"<<endl<<endl; cout<<"\t\t\t1.按月統(tǒng)計(jì)輸出的汽車修理單信息"<<endl<<endl; cout<<"\t\t\t2.按月統(tǒng)計(jì)每個(gè)修理工的月修理信息"<<endl<<endl; cout<<"\t\t\t0.返回上一菜單"<<endl<<endl; cout<<"\t\t\t輸入統(tǒng)計(jì)方式:"; cin>>n; switch(n) { case1:Statistics1();break; case2:Statistics2();break; case0:flag=0;break; default:cout<<"\t輸入錯(cuò)誤!請(qǐng)重新輸入!"<<endl<<endl; } } }private: car_inforcarr;};//******顯示界面******charmenu(){ cout<<endl<<endl; cout<<"\t\t*******汽車汽修管理系統(tǒng)*******"<<endl<<endl; cout<<"\t\t車輛信息維護(hù)"<<endl; cout<<"\t\t\t1.增加車輛信息"<<endl; cout<<"\t\t

溫馨提示

  • 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. 人人文庫(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)論