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

下載本文檔

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

文檔簡介

1、目錄一、設(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. 通過課程設(shè)計(jì)掌握面向?qū)ο蟮某绦蛟O(shè)計(jì)思路。2. 通過課程設(shè)計(jì)掌握類的繼承、抽象類、多態(tài)、虛基類的應(yīng)用方法。3. 通過課程設(shè)計(jì)掌握C+中對文件進(jìn)行查找、刪除、修改等操作方法。三、設(shè)計(jì)說明1. 系統(tǒng)功能需求描述本系統(tǒng)主要實(shí)現(xiàn)車輛信息、車輛修理單信息的插入、刪除及查詢等功能。 編程實(shí)現(xiàn)汽車汽修管理系統(tǒng),主要汽車汽修管理系統(tǒng)。其中車輛信息應(yīng)該包括 車牌號、牌號、型號、生產(chǎn)廠家、修理項(xiàng)目碼、修理日期、修理項(xiàng)目、修理小 時(shí)數(shù)、完工日期。車輛修理

2、菜單信息包括修理單編號、修理工工號、修理日 期、修理項(xiàng)目、修理小時(shí)數(shù)、完工日期。具體功能如下:(1用戶登錄界面設(shè)計(jì)。(2信息維護(hù):包括車輛信息維護(hù):增加車輛信息、刪除車輛信息、膝蓋 車輛信息。包括車輛修理單信息維護(hù):增加車輛修理單信息、刪除和良修理單 信息、修改車輛修理單信息。(3信息查詢:對車輛信息查詢時(shí)可實(shí)現(xiàn)按車輛名查詢、按車主名查詢等 多條件查詢。對車輛修理單信息查詢時(shí)可實(shí)現(xiàn)按車輛修理單號查詢、按修理工 工號查詢等多條件查詢。(4修理單統(tǒng)計(jì):按月統(tǒng)計(jì)輸出上的汽車修理單信息。按月統(tǒng)計(jì)每個修理 工的月修理信息。2. 系統(tǒng)運(yùn)行環(huán)境1硬件環(huán)境。本系統(tǒng)適用于那種Inter386以上計(jì)算機(jī),內(nèi)存容量

3、為 128M應(yīng)配備鍵盤、鼠標(biāo)、顯示器等外部設(shè)備。2軟件環(huán)境。本系統(tǒng)的設(shè)計(jì)采用 Visual C+6.0編寫。在 Windows XP SP2環(huán)境下測試通過。四、總體設(shè)計(jì)1. 數(shù)據(jù)設(shè)計(jì)(1類設(shè)計(jì)車輛信息類car_infor,該類有共同的信息車牌號car_no、牌號 car_brand、型號 car_modles、生產(chǎn)廠家 manufacturer、修理項(xiàng)目碼 repair_code、車主姓名 owner_name 聯(lián)系電話 phone_nombe、修理日期 repair_time。車輛修理菜單信息類repair_list,該類有共同的修理單編號list_no、修理工工號 repaiman_no、

4、修理日期 repair_time、修理項(xiàng)目project、修理小時(shí)數(shù) repair_hours、完工日期 complete_time。用戶信息類 user,該類有成員用戶名 user_name 密碼password。功能類fun,該類中包含 所有的功能函數(shù),實(shí)現(xiàn)對車輛信息及車輛修理單信息的增加、修改、刪除以及 統(tǒng)計(jì)等實(shí)用功能。void add(>增加車輛信息,void del(>刪除車輛信息,void modify (>修改車輛信息,void add_list(>增加車輛修理單信息,voiddel_list(> 刪除車輛修理單信息,void modify_list

5、(>修改車輛修理單信息,int Judge(> 判斷函數(shù),void query_car(> 查詢車輛信息,void query_list(> 查詢車輛修理單信息,void query_car_no(> 按車輛名查詢,void query_owner_name(>®車主名查詢,void query_repaiman_no(> 按修理工工號 查詢,void query_rlist_no(>按車輛修理單號查詢,Statistics(>修理單統(tǒng)計(jì)等。(2>函數(shù)設(shè)計(jì)Int registe(> 用戶注冊,int Judge6(&g

6、t; 用戶登錄,void add(>增加車輛 信息,void del(>刪除車輛信息,void add_list(>增加車輛修理單信息,void modify (>修改車輛信息,void del_list(>刪除車輛修理單信息,voidmodify_list(> 修改車輛修理單信息,int Judge(>判斷函數(shù),void query_car(>查詢車輛信息,void query_list(>查詢車輛修理單信息,voidquery_car_no(> 按車輛名查詢,void query_owner_name(> 按車主名查詢, v

7、oid query_repaiman_no(> 按修理工工號查詢,void query_rlist_no(>按車輛修理單號查詢,void Statistics(>1按月輸出汽車修理單信息,voidStatistics(>2統(tǒng)計(jì)每個修理工的月修理信息。2. 結(jié)構(gòu)設(shè)計(jì)系統(tǒng)流程圖如圖4-1所示。Mail函 數(shù)圖4-1系統(tǒng)流程圖五、詳細(xì)設(shè)計(jì)V1)用戶登錄/注冊界面設(shè)計(jì)歡迎使用汽車汽修管理系統(tǒng)Judge6<<2丄用戶登錄2 用戶注冊諭入您的選if: 1相關(guān)提示進(jìn)入下一步O據(jù)的增加操作。歡迎登錄汽車汽修管理系統(tǒng)用戶名=ad«fn密碼:1219登錄成功餡請按任意

8、鍵繼續(xù)-請按提示輸入車輛信息:車牌號:踽8汽車的牌號;奔馳汽車的型號:奔888生產(chǎn)廠家:china修理項(xiàng)目碼:RfiHSR車王姓名聯(lián)系電話:關(guān)跚U修理H期汁月陽彳言息錄入完成* * t 請按任意犍繼續(xù)-遠(yuǎn)薩修改?備再次輸人要修改的車輛的車牌號:SB8請搜提示重新輸入車輛信息,車牌號涔汽車的牌號:奔馳按車輛名查詢筑按車主名餐詢3 刷新顯示界面“返回上一棊單aha入您逸擇的査詢方式次下 豊:0鴛月 D9 )8efl-a88 $網(wǎng)二: 息:6料穀家WWK 嘻覇廠頂#看圖5-6查詢車輛信息此界面調(diào)用query_car(函數(shù),此函數(shù)包含其他兩函數(shù)工能,因此用戶根 據(jù)提示選擇自己的查詢方式。(7統(tǒng)計(jì)車輛修

9、理單信息示選擇相關(guān)需要統(tǒng)計(jì)。:、結(jié)論、修改、查詢以及用戶的注冊、登錄等功能。并且還能夠?qū)崿F(xiàn)相關(guān)功能間的 環(huán)轉(zhuǎn)換,本次開發(fā)主要用了'依靠文件的相關(guān)控制。因此在實(shí)現(xiàn)和代碼上有許多值得改進(jìn)和的地方。因?yàn)?間原因,程序功能相關(guān)部分,還有許多地方值得推敲和拓展開發(fā)。際的需求有出入,主要是在技術(shù)上和需求分析上問題,因此該系統(tǒng)還是有尚 要改進(jìn)的部分。可能因?yàn)闀r(shí)間的原因,有些地方做得不夠精細(xì),所學(xué)的東西不能全部用好。多多把所學(xué)的運(yùn)用到實(shí)際中是以后的編程中應(yīng)該加強(qiáng)和注意 的。七、附錄 <程序源代碼):#include<iostream>#include<string>#in

10、clude<fstream>#include <sstream>#include<iomanip>#include<stdio.h>using namespace std 。/* 車輛信息類 *class car_inforpublic:car_infor(>private:string car_no。/車牌號string car_brand/ 牌號string car_modles。/ 型號string manufacturer。 / 生產(chǎn)廠家string repair_code。/ 修理項(xiàng)目碼string owner_name。/ 車主

11、姓名string phone_number。 / 聯(lián)系電話string repair_time。/ 修理日期。/*修理單類 *class repair_listpublic:repair_list(>private:string list_no 。 / 修理單編號string repairman_no 。 / 修理工工號 string repair_time。 / 修理日期string project 。 / 修理項(xiàng)目string repair_hours。 / 修理小時(shí)數(shù)string complete_time 。 / 完工日期 。/* 用戶信息類 * class userpublic

12、:user(>private:string user_name 。 / 用戶名string password 。 / 密碼。/*功能類 *class fun public:fun(> /*信息維護(hù)*/* 增加車輛信息 *void add(>system("cls"> 。string a,b,c,d,e,f,g,h 。string line 。ofstream car("d:cars.txt", ios:app> if(!car>cerr<<"open error!"<<end

13、lexit(1> int flag=1 。 while(flag> cout<<endl<<endl cout<<"ttt*"<<endlcout<<"ttt1.增加汽車信息 "<<endl<<endl 。cout<<"ttt0.返回上一菜單 "<<endl 。cout<<"ttt*"<<endlcout<<"ttt請輸入您的選擇 :" 。i

14、nt n 。cin>>n 。switch(n>case 1:system("cls"> 。cout<<endl 。cout<<"t 請按提示輸入車輛信息 :"<<endl<<endl 。 cout<<"t 車牌號 :" 。cin>>a 。cout<<endl 。 cout<<"t 汽車的牌號 :" 。 cin>>b 。cout<<endl 。 cout<<&qu

15、ot;t 汽車的型號 :" 。 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>

16、;>g 。cout<<endl 。cout<<"t 修理日期 :" 。cin>>h 。cout<<endl 。'<<b<<' '<<c<<'car<< setiosflags(ios:left><<a<<''<<d<<' '<<e<<' '<<f<<' '<&l

17、t;g<<' '<<h<<endl。!" << endl <<system("cls"> 。 cout << endl <<"tt信息錄入完成endl 。system("pause"> 。 break 。輸入錯誤case 0:flag=0 。 system("cls"> 。 break 。default:system("cls">。 cout<<endl<

18、<endl<<endl<<"ttt請重新輸入 !" 。car.close(> 。/* 判斷函數(shù) *int Judge1(string car_n,string line>ifstream car("d:cars.txt"> 。string a,b,c,d,e,f,g,h 。while(getline(car,line>>istringstream is(line>。is>>a>>b>>c>>d>>e>>f>>

19、;g>>h 。if(car_n=a>return 1 。return 0 。/* 刪除車輛信息 * void del(>system("cls"> 。string a,b,c,d,e,f,g,h 。string line 。string car_no 。ifstream car("d:cars.txt"> 。 if(!car>cerr<<"cars.txt can't open!"<<endl exit(1> 。ofstream temp("d:

20、temp.txt"> 。if(!temp>cerr<<"temp.txt can't open!"<<endl exit(1> 。int flag=1 。while(flag><<endl cout<<endl<<endl 。cout<<"tttcout<<"ttt1.刪除車輛信息 "<<endl<<endl 。cout<<"ttt0.返回上一菜單 "<<

21、;endl 。<<endlcout<<"ttt cout<<"ttt 請輸入您的選擇 :" 。int flag1=1 。int n 。cin>>n 。switch(n>case 1:string car_n 。cout<<endl 。cout<<"ttt 請輸入要刪除的車輛的車牌號cin>>car_n 。 if(Judge1(car_n,line>=1>system("cls"> 。 cout<<endl<&l

22、t;endl<<endl 。 cout<<"tt 存在這輛汽車,確定 要刪除? (Y/N>"<<endl<<endl 。cout<<"tt 請 輸 入 您 的 選 擇 :"<<endl 。cout<<"tt" 。 char ch 。 cin>>ch 。 switch(ch> case 'Y':while(getline(car,line>&&flag1> string a,b,c,d,

23、e,f,g,h 。string line 。 string car_n 。 string car_no 。 cout<<"tt 請 再 次輸入要刪除的車輛的車牌號 :"<<endl 。cout<<"tt" 。 cin>>car_n 。 ifstream car("d:cars.txt"> 。ofstream temp("d:tem.txt"> 。while(getline(car,line>>istringstream is(line>

24、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<

25、<' '<<f<<' '<<g<<' '<<h<<endl 。ofstream car1("d:cars.txt",ios:trunc> 。ifstream temp1("d:tem.txt"> 。while(getline(temp1,line>>istringstream is(line> 。is>>a>>b>>c>>d>>e>&g

26、t;f>>g>>h 。car1<<setiosflags(ios:left> << setw(20> << a<<' '<< b<<' '<<c<<' '<<d<<' '<<e<<' '<<f<<' '<<g<<' '<<h<<endl

27、。 ofstream temp2("d:tem.txt",ios:trunc> 。temp2.close(> 。 car.close(> 。car1.close(> 。 temp.close(> 。 temp1.close(> 。 system("cls"> 。cout<<endl<<endl<<"ttt 信息已成功刪除 !"<<endl<<endl 。flag1=0 。 。 break 。case'N':system

28、("cls"> 。continue。break。 default:system("cls"> 。cout<<endl<<endl<<endl<<"ttt 輸入錯誤 ! 請重新輸入 !" 。 /+ elsesystem("cls"> 。cout << endl<<endl<< "ttt沒有這輛車的信息 !"<<endl<<endl 。break 。 。 break 。cas

29、e 0:flag=0 。 break 。 default:system("cls"> 。 cout<<endl<<endl<<endl<<"ttt輸入錯誤 ! 請重新輸入 !" 。car.close (>。temp.close(> 。/* 修改車輛信息 *void modify(>system("cls"> 。string a,b,c,d,e,f,g,hstring line string car_n cout<<endl 。ifstream c

30、ar("d:cars.txt"> 。 if(!car>cerr<<"cars.txt can't open!"<<endl exit(1> 。ofstream temp("d:tem.txt"> 。if(!temp>cerr<<"tem.txt can't open!"<<endl exit(1> 。int flag=1,flag1=1 。while(flag>cout<<endl<<e

31、ndl 。<<endlcout<<"tttcout<<"ttt1.修改車輛信息 "<<endl<<endl 。cout<<"ttt0.返回上一菜單 "<<endlcout<<"ttt*"<<endlcout<<"ttt請輸入您的選擇 :" 。int n 。cin>>n 。switch(n>case 1:string car_ncout<<endl 。cout

32、<<"ttt請輸入要修改的汽車號碼 :"<<endl 。cout<<"ttt"cin>>car_n 。 if(Judge1(car_n,line>=1>system("cls"> 。 cout<<endl<<endl<<endl 。 cout<<"tt 存在這輛汽車,確定 修改? (Y/N>"<<endl 。cout<<"tt 請 輸 入 您 的 選 擇 :&qu

33、ot;<<endl 。cout<<"tt" 。 char ch 。 cin>>ch 。 switch(ch> case 'Y':while(getline(car,line>&&flag1> string a,b,c,d,e,f,g,h 。string line 。 string car_n 。 string car_no 。 cout<<"tt 請 再 次輸入要修改的車輛的車牌號 :"<<endl 。cout<<"tt&q

34、uot; 。 cin>>car_n 。 ifstream car("d:cars.txt"> 。ofstream temp("d:tem.txt"> 。while(getline(car,line>>istringstream is(line> is>>a>>b>>c>>d>>e>>f>>g>>h 。if(!car>cout<<" 您要的信息不存在 " 。if(car_n!=a&g

35、t;temp<<setiosflags(ios:left><<a<<' '<< b<<' '<<c<<' '<<d<<' '<<e<<' '<<f<<' '<<g<<' '<<h<<endl 。ofstream car1("d:cars.txt",ios:t

36、runc> 。ifstream temp1("d:tem.txt"> 。while(getline(temp1,line>>istringstream is(line> 。is>>a>>b>>c>>d>>e>>f>>g>>h 。car1<<setiosflags(ios:left> << setw(20> << a<<' '<< b<<' &#

37、39;<<c<<' '<<d<<' '<<e<<' '<<f<<' '<<g<<' '<<h<<endl。 ofstream temp2("d:tem.txt",ios:trunc> 。temp2.close(> 。 temp.close(> 。提示重新輸入車輛信息 :"<<endl<<endl 。號:

38、"的牌號 :" 。的型號 :" 。家:" 。目碼 :" 。名:"話 :" 。期:"temp1.close(> 。 system("cls"> 。 cout<<endl 。 cout<<"tt請 按cout<<"tt車 牌cin>>a 。 cout<<endl 。 cout<<"tt 汽 車cin>>b 。 cout<<endl 。 cout<<&q

39、uot;tt 汽 車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 。cin>>h 。cout<<end

40、l 。 car1<< setiosflags(ios:left><<a<<' '<<b<<' '<<c<<' '<<d<<' '<<e<<' '<<f<<' '<<g<<' '<<h<<endl 。system("cls"> 。 cout <&l

41、t; endl <<"tt 新信息錄入完成 !" << 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&

42、lt;<"ttt 輸入錯誤 ! 請重新輸入 !" 。 /+else system("cls"> 。cout << endl<<endl<< "ttt沒有該輛車的信息 !"<<endl<<endl 。break 。 。 break 。case 0:flag=0 。 break 。default:system("cls"> 。 cout<<endl<<endl<<endl<<"ttt

43、輸 入錯誤 ! 請重新輸入 !" 。 car.close(> 。 temp.close(> 。/* 增加車輛修理單信息void add_list(>system("cls"> 。 string a,b,c,d,e,f string line ofstream car_list("d:cars_list.txt", ios:app> if(!car_list>cerr<<"open error!"<<endl 。 exit(1> 。int flag=1 。whi

44、le(flag>cout<<endl<<endl 。<<endlcout<<"ttt cout<<"ttt1. 增加車輛修理單信息 "<<endl<<endl 。cout<<"ttt0. 返回上一菜單 "<<endl 。<<endlcout<<"ttt cout<<"ttt 請輸入您的選擇 :" int n 。cin>>n 。switch(n>cas

45、e 1:system("cls"> 。cout<<endl 。cout<<"t 請 按 提 示 輸 入 車 輛 修 理 單 信 息 :"<<endl<<endl 。cout<<"t 修理單編號 :" 。cin>>a 。cout<<endl 。cin>>b 。cout<<endl 。cout<<"t 修理日期 :" 。 cin>>c 。cout<<endl 。 cout

46、<<"t 修理項(xiàng)目 :" 。 cin>>d 。cout<<endl 。 cout<<"t 修理小時(shí)數(shù) :" 。 cin>>e 。cout<<endl 。 cout<<"t 完工日期 :" 。 cin>>f 。cout<<endl 。'<<b<<'<< endl輸入錯誤car_list<< setiosflags(ios:left><<a<&l

47、t;' '<<c<<' '<<d<<' '<<e<<' '<<f<<endl。system("cls"> 。cout << endl <<"tt修理單信息錄入完成 !"<< endl 。system("pause"> 。 break 。 case 0:flag=0 。 system("cls"> 。 br

48、eak 。 default:system("cls">。 cout<<endl<<endl<<endl<<"ttt請重新輸入 !" 。car_list.close(> 。/* 判斷函數(shù) *int Judge2(string list_n,string line>ifstream list("d:cars_list.txt">。string a,b,c,d,e,f 。while(getline(list,line>>istringstream is(li

49、ne>is>>a>>b>>c>>d>>e>>f 。 if(list_n=a>return 1 。return 0 。/* 刪除車輛修理單信息 * void dele_list(>system("cls"> 。 string a,b,c,d,e,f string line 。string list_no ifstream car_list("d:cars_list.txt"> if(!car_list>cout<<endl<<

50、endl<<endl 。cerr<<"tttcar_list.txt can't open!"exit(1> 。ofstream temp("d:tem.txt"> 。if(!temp>cerr<<"tem.txt can't open!"<<endlexit(1> 。int flag=1 。while(flag><<endlcout<<endl<<endl 。cout<<"tttco

51、ut<<"ttt1.刪除車輛修理單信息"<<endl<<endl 。cout<<"ttt*"cout<<"ttt請輸入您的選擇 :" 。int flag1=1 int n 。cin>>n 。 switch(n> case 1:string list_n。cout<<endl 。cout<<"ttt 請 輸 入 要 刪 除 的 修 理 單 編號:"<<endl。cout<<"ttt&

52、quot; 。cin>>list_n 。 if(Judge2(list_n,line>=1>system("cls"> 。 cout<<endl<<endl<<endl 。cout<<"tt 存在這張修理單 , 確定要刪除 ?(Y/N>"<<endl<<endl 。cout<<"tt 請 輸 入 您 的 選擇 :"<<endl 。 cout<<"tt" 。 char ch

53、。 cin>>ch 。 switch(ch> case 'Y':while(getline(car_list,line>&&flag1> string a,b,c,d,e,f 。string line string list_ncout<<"tt請?jiān)俅屋斎胍獎h除的修理單編號 :"<<endl 。cout<<"tt" cin>>list_n ifstream car_list("d:cars_list.txt">。 /co

54、ut<<car.rdbuf(>。ofstream temp("d:temp.txt"> 。while(getline(car_list,line>>istringstream is(line> is>>a>>b>>c>>d>>e>>f 。if(!car_list>cout<<" 您要的信息不存在 " 。 if(list_n!=a>'<<e<<' temp<<setio

55、sflags(ios:left><<a<<' '<< b<<' '<<c<<' '<<d<<' '<<f<<endl 。 ofstream car_list1("d:d:cars_list.txt",ios:trunc> 。ifstream temp1("d:temp.txt"> 。while(getline(temp1,line>>istri

56、ngstream is(line> 。 is>>a>>b>>c>>d>>e>>f 。car_list1<<setiosflags(ios:left><<a<<''<<e<<' '<<f<<endl 。temp2("d:temp.txt",ios:trunc> 。car_list1.close(> 。'<< b<<' '

57、<<c<<' '<<d<<'ofstreamtemp2.close(> 。temp.close(> 。 temp1.close(> 。 system("cls"> 。car_list.close(> 。cout<<endl<<endl<<"ttt 信息已成功刪除 !"<<endl<<endl 。flag1=0 。 。 break 。 case'N':system("cl

58、s">。 continue。 break 。default:system("cls">cout<<endl<<endl<<endl<<"ttt輸入錯誤! 請重新輸入 !" 。elsesystem("cls">。cout<<endl<<endl<<"ttt 沒有這修理單的信息 !"<<endl<<endlbreak 。 break 。case 0:flag=0 。 break 。de

59、fault:system("cls"> 。 cout<<endl<<endl<<endl<<"ttt 輸 入錯誤 ! 請重新輸入 !" 。car_list.close(> 。 temp.close(> 。/* 修改車輛修理單信息 *void modify_list(>system("cls"> 。string a,b,c,d,e,f,g。string line 。string car_n 。 cout<<endl 。ifstream car(&q

60、uot;d:cars_list.txt"> 。 if(!car>cerr<<"cars_list.txt can't open!"<<endl exit(1> 。ofstream temp("d:temp.txt"> 。if(!temp>cerr<<"temp.txt can't open!"<<endl exit(1> 。int flag=1,flag1=1 。while(flag>cout<<endl&l

61、t;<endl 。cout<<"ttt*"號:"<<endl。cout<<"ttt1. 修改修理單信息 "<<endl<<endl 。cout<<"ttt0. 返回上一菜單 "<<endl 。cout<<"tttcout<<"ttt int n 。 cin>>n 。 switch(n> case 1:修改? (Y/N>"<<endl<<

62、endl 。擇:"<<endl。<<endl請輸入您的選擇string car_n 。cout<<endl 。cout<<"ttt 請 輸 入 要 修 改 的 修 理 單 編cout<<"ttt" 。cin>>car_n 。 if(Judge2(car_n,line>=1>system("cls"> 。cout<<endl<<endl<<endl 。cout<<"tt 存在這修理單,確定c

63、out<<"tt 請 輸 入 您 的 選cout<<"tt" 。char ch 。cin>>ch 。switch(ch>case 'Y':while(getline(car,line>&&flag1>stringa,b,c,d,e,f,gstring line 。 string car_n 。 string car_no 。 cout<<"tt 請 再 次輸入要修改的修理單號 :"<<endl 。cout<<"tt

64、" 。cin>>car_n 。 ifstream car("d:cars_list.txt"> 。ofstream temp("d:temp.txt"> 。while(getline(car,line>> istringstream is(line> 。is>>a>>b>>c>>d>>e>>f>>g 。if(!car> cout<<" 您要的信息不存在 " 。 if(car_n!=a

65、>temp<<setiosflags(ios:left><<a<<''<<f<<endl 。'<< b<<' '<<c<<' '<<d<<' '<<e<<' ofstreamcar1("d:cars_list.txt",ios:trunc>ifstreamtemp1("d:temp.txt">whi

66、le(getline(temp1,line>> istringstream is(line>is>>a>>b>>c>>d>>e>>f>>g 。car1<<setiosflags(ios:left><<'<<f<<endl 。temp2("d:tem.txt",ios:trunc>示重新輸入修理單信息 :"<<endl<<endl 編號 :" 。工工號 :"

67、; 。期:" 。a<<' '<< b<<' '<<c<<' '<<d<<' '<<e<<' ofstreamtemp2.close(> 。 temp.close(> 。temp1.close(> 。 system("cls"> 。 cout<<endl 。 cout<<"t 請按提cout<<"t 修理單ci

68、n>>a 。 cout<<endl 。 cout<<"t 汽修理cin>>b 。 cout<<endl 。cout<<"t 修理日cin>>c 。 cout<<endl 。目:" 。cin>>d 。 cout<<endl 。 cout<<"t 修理小時(shí)數(shù) :" 。cin>>e 。 cout<<endl 。 cout<<"t 完工日期:" 。cin>>

69、;f 。 cout<<endl 。 car1<<setiosflags(ios:left><<a<<' '<<b<<' '<<c<<' '<<d<<' '<<e<<' '<<f<<endl。 system("cls"> 。 cout << endl<<"tt 新信息錄入完成 !&quo

70、t; << endl << endlsystem("pause"> 。 break 。car.close(> 。 car1.close(> 。 flag1=0 。 。 break 。 case 'N':system("cls"> continue 。 break 。default:system("cls"> cout<<endl<<endl<<endl<<"ttt 輸入錯誤 ! 請重新輸入 !" 。

71、 else system("cls"> 。cout << endl<<endl<< "ttt沒有該輛車的信息 !"<<endl<<endl 。break 。 。 break case 0:flag=0 。 break 。default:system("cls"> 。 cout<<endl<<endl<<endl<<"ttt入錯誤 ! 請重新輸入 !" 。car.close(> 。temp.c

72、lose(> 。/*信息查詢 */* 按車輛名查詢 *void query_car_no(>system("cls"> 。string a,b,c,d,e,f,g,h。string line 。string car_n 。string car_no 。cout<<endl<<endl<<endl 。cout<<"tt"<<" 請輸入要查詢的車輛名 :" cin>>car_n 。ifstream car("d:cars.txt"

73、> 。 if(!car>cerr<<"cars.txt can't open!"<<endlexit(1> 。ofstream temp("d:tem.txt"> 。if(!temp>cerr<<"tem.txt can't open!"<<endlexit(1> 。if(Judge1(car_n,line>=1>while(getline(car,line>> istringstream is(line>

74、 。 is>>a>>b>>c>>d>>e>>f>>g>>h 。 if(car_n=a>cout<<endl<<endl 。cout<<"tt車輛信息如下 "<<endl 。cout<<"tt車牌號 :"<<a<<endl 。cout<<"tt牌號 :"<<b<<endl 。cout<<"tt型號

75、 :"<<c<<endl 。cout<<"tt生產(chǎn)廠家 :"<<d<<endl 。cout<<"tt修理項(xiàng)目碼 :"<<e<<endl 。cout<<"tt車主姓名 :"<<f<<endl 。cout<<"tt聯(lián)系電話 :"<<g<<endl 。cout<<"tt修理日期 :"<<h<<

76、;endl 。elsecout<<endl<<"tt 沒有這輛車的信息 !"<<endl 。car.close(> 。temp.close(> 。system("del d:tem.txt">。system("pause"> 。/* 判斷函數(shù) *int Judge4(string car_n,string line>ifstream car("d:cars.txt"> 。string a,b,c,d,e,f,g,h 。while(getline(car,line>>istringstream is(line> 。 is>>a>>b>>c>>d>>e>>f>>g>>h 。 if(car_n=f>ret

溫馨提示

  • 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

提交評論