付費(fèi)下載
下載本文檔
版權(quán)說(shuō)明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
1、/(1) 登錄管理模塊:主要實(shí)現(xiàn)登錄身份的管理、密碼管理#include <iostream>#include <fstream>#include <string>#include <iomanip>using namespace std;class Logoprivate:string name;string password;public:int in();/接受用戶登錄請(qǐng)求,決定是否允許登入void reg();/ 用戶注冊(cè)void print(); / 用戶登錄界面提示;int Logo:in()string n,p;int i=0,j=
2、0;/j 值表示是否存在此用戶cout<<"輸入姓名"<<endl;cin>>n;cout<<"輸入密碼"<<endl;cin>>p;ifstream input;input.open ("logoinfo.txt");while(!input.eof ()input>>name>>password;if(name=n&&p=password)i=1;if(n=name) j=1;input.close ();if(j=0)
3、cout<<"用戶不存在,請(qǐng)先注冊(cè) !"<<endl;return i; /i 值為 1 表示登錄成功;為0 時(shí)表示登錄失敗void Logo:reg ()/ofstream output;output.open ("logoinfo.txt",ios:out|ios:app);cout<<"輸入你的姓名:"<<endl;cin>>name;cout<<"輸入密碼(有效位數(shù)8-16)"<<endl;cin>>passwo
4、rd;while(password.size ()<8|password.size ()>16) cout<<"密碼無(wú)效,請(qǐng)重新輸入"<<endl;cin>>password;output<<name<<' '<<password<<endl;output.close ();cout<<"注冊(cè)成功"<<endl;void Logo:print ()cout<<setw(40)<<" 歡迎
5、使用房屋中介管理系統(tǒng)"<<endl;cout<<"請(qǐng)選擇操作:"<<endl;cout<<"ttt1 、用戶登錄"<<endl;cout<<"ttt2 、用戶注冊(cè)"<<endl;/(2) 房屋信息管理模塊:房屋信息的增、刪、改、查。類 House, name(物業(yè)名稱),place(地段),type(戶型),direction(朝向),area(面積),equip(房屋設(shè) 施 ),price( 價(jià)格 ),/ 使用文件“houseinfo.tx
6、t ” ,"hsize.txt"class Houseprivate:string name,place,type,direction,equip;float area,price;public:string getname1() return House:name;unsigned long hsize;void add();/增加一條房屋信息void del();/刪除一條房屋信息void alter(); /修改一條房屋記錄void select(); / 查找房屋信息void set(string n,string p,string t,string d,strin
7、g e,float a,float pr)name=n;place=p;type=t;direction=d; equip=e;area=a;price=pr;)void print()(fstream inout;inout.open("houseinfo.txt",ios:out|ios:app);inout<<name<<' '<<place<<' '<<type<<' '<<direction<<' '<
8、;<equip<<' '<<area<<<<price<<endl;inout.close(););僅特殊用戶能增加操作void House:add () (fstream isize;isize.open ("hsize.txt",ios:in);isize>>hsize;isize.close(); /對(duì)文件hsize.txt操作,讀出房屋的信息條數(shù);fstream inout;inout.open ("houseinfo.txt",ios:out|ios二
9、app);cout<<"輸入物業(yè)名稱:"<<endl;cin>>name;cout<<"輸入房屋地段:"<<endl;cin>>place;cout<<"輸入房屋戶型:"<<endl;cin>>type;cout<<"輸入房屋朝向:"<<endl;cin>>direction;cout<<"輸入房屋設(shè)施:"<<endl;cin&g
10、t;>equip;cout<<"輸入房屋面積:"<<endl;cin>>area;cout<<"輸入房屋價(jià)格:"<<endl;cin>>price;inout<<name<<' '<<place<<''<<type<<' '<<direction<<' '<<equip<<''&l
11、t;<area<<<<price<<endl;inout.close ();hsize+;fstream osize;osize.open ("hsize.txt",ios:out);osize<<hsize;osize.close (); /對(duì)文件 hsize.txt 操作,寫入新的房屋的信息條數(shù)cout<<"房屋信息更新完成。"<<endl;void House:del()string isname;fstream isize;isize.open ("hsize
12、.txt",ios:in);isize>>hsize;isize.close(); /對(duì)文件 hsize.txt 操作,讀出房屋的信息條數(shù);cout<<"輸入你需要?jiǎng)h除的物業(yè)名字:"<<endl;cin>>isname;House *a=new Househsize;int i=0,flag=0;ifstream input;input.open ("houseinfo.txt",ios:in);while(!input.eof ()input>>name>>place&g
13、t;>type>>direction>>equip>>area>>price; if(name=isname)flag+; /flag 記錄要?jiǎng)h除房屋的個(gè)數(shù)continue;elseai.set (name,place,type,direction,equip,area,price);i+;input.close();ofstream output;output.open("houseinfo.txt",ios:out);for(i=0;i<hsize-flag;i+)ai.print();output.close
14、();fstream osize;osize.open ("hsize.txt",ios:out);osize<<hsize-flag;osize.close ();void House:alter()cout<<"輸入你需要更新的物業(yè)名字即"<<endl;House:del();cout<<"輸入更新后房屋信息"<<endl;House:add ();void House:select()string hname;fstream inout;cout<<&quo
15、t;輸入你要查詢的物業(yè)名稱"<<endl;cin>>hname;inout.open ("houseinfo.txt",ios:in);while(!inout.eof ()inout>>name>>place>>type>>direction>>equip>>area>>price; if(name=hname)cout<<"物業(yè)名稱"<<name<<endl;cout<<"房屋
16、地段"<<place<<endl;cout<<"房屋戶型"<<type<<endl;cout<<"房屋朝向"<<direction<<endl;cout<<"房屋設(shè)施"<<equip<<endl;cout<<"房屋面積"<<area<<endl;cout<<"房屋價(jià)格"<<price<<
17、;endl;elsecontinue;inout.close ();/(3)顧客管理模塊,顧客信息的增、刪、改、查。類Customer cname(顧客姓名),tel(聯(lián)系方式),/ 使用文件“coustomerinfo.txt ” ,"csize.txt"class Customer private:string cname,tel;public:string getname2() return Customer:cname; unsigned long csize;void add();/增加一條客戶信息void del();/刪除一條客戶信息void alter();
18、 /修改一條客戶記錄void select(); / 查找客戶信息 void set(string cn,string te)cname=cn; tel=te; void print()fstream inout;inout.open("customerinfo.txt",ios:out|ios:app);inout<<cname<<' '<<tel<<endl; inout.close();void Customer:add ()/ 僅特殊用戶能增加操作fstream isize;isize.open (&q
19、uot;csize.txt",ios:in);isize>>csize;isize.close(); /對(duì)文件csize.txt操作,讀出客戶的信息條數(shù);fstream inout;inout.open ("customerinfo.txt",ios:out|ios:app);cout<<"輸入客戶名稱:"<<endl;cin>>cname;cout<<"輸入客戶聯(lián)系方式:"<<endl;cin>>tel;inout<<cname
20、<<' '<<tel<<endl;inout.close ();csize+;fstream osize;osize.open ("csize.txt",ios:out);osize<<csize;osize.close (); 對(duì)文件csize.txt操作,寫入新的客戶的信息條數(shù) cout<<"客戶信息更新完成。"<<endl;void Customer:del()string isname;fstream isize;isize.open ("csize
21、.txt",ios:in);isize>>csize;isize.close();/對(duì)文件csize.txt操作,讀出客戶的信息條數(shù);cout<"輸入你需要?jiǎng)h除的客戶名字:"<<endl;cin>>isname;Customer *b=new Customercsize;int i=0,flag=0;ifstream input;input.open ("customerinfo.txt",ios:in);while(!input.eof ()input>>cname>>tel;
22、if(cname=isname)flag+; /flag 記錄要?jiǎng)h除客戶的個(gè)數(shù)continue;elsebi.set (cname,tel);i+;input.close();ofstream output;output.open("customerinfo.txt",ios:out);for(i=0;i<csize-flag;i+)bi.print();output.close();fstream osize;osize.open ("csize.txt",ios:out);osize<<csize-flag;osize.close
23、();void Customer:alter()cout<"輸入你需要更新的客戶名字即"<<endl;Customer:del();cout<<"輸入更新后客戶信息"<<endl;Customer:add ();void Customer:select()string find;fstream inout;cout<<"輸入你要查詢的客戶名稱"<<endl;cin>>find;inout.open ("customerinfo.txt",
24、ios:in);while(!inout.eof ()inout>>cname>>tel;if(cname=find)cout<<" 客戶姓名"<<cname<<endl;cout<<" 客戶聯(lián)系方式"<<tel<<endl;elsecontinue;inout.close ();/(4)統(tǒng)計(jì)模塊tj類,size統(tǒng)計(jì)數(shù)class tjprivate:int size;public:void hsum() /統(tǒng)計(jì)房屋總數(shù)fstream input;input.o
25、pen ("houseinfo.txt",ios:in);input>>size;input.close ();cout<<"房屋總數(shù)為:"<<size<<endl;void csum() / 統(tǒng)計(jì)顧客總數(shù)fstream input;input.open ("customer.txt",ios:in);input>>size;input.close ();cout<<"顧客的總數(shù)為:"<<size<<endl;int m
26、ain()Logo customer;int i,flag1,flag2,flag3,flag4,flag5,flag6,flag7;customer.print ();/ 登錄管理提示cin>>flag1;if(flag1=1)flag2=customer.in ();/ 用戶登錄while(flag2=0) cout<<"ttt 您登錄失敗。"<<endl;cout<<"ttt3 退出系統(tǒng)"<<endl;cout<<"ttt 其他數(shù)字重新登錄"<<
27、endl;cout<<"ttt 請(qǐng)選擇:"<<endl;cin>>i;if(i=3)return 0;flag2=customer.in ();else if(flag1=2)customer.reg ();/ 新用戶注冊(cè)"<<endl;cout<<"你將退出系統(tǒng),如需其他操作請(qǐng)重新登錄系統(tǒng) return 0;else cout<<" 輸入有誤"<<endl;return 0;system("cls");cout<<&q
28、uot;恭喜您登錄成功!"<<endl;cout<<setw(40)<<"( 主菜單)請(qǐng)選擇操作類型:"<<endl;cout<<"ttt1 表示房屋信/客戶息查詢;"<<endl;cout<<"ttt2 表示房屋/顧客信息進(jìn)行增刪改;"<<endl;cout<<"ttt3 表示進(jìn)行相關(guān)信息統(tǒng)計(jì)"<<endl;cin>>flag3;switch(flag3)case 1:sy
29、stem("cls");cout<<"歡迎進(jìn)入信息查詢系統(tǒng) "<<endl;cout<<setw(40)<<" 輸入查詢的方面:"<<endl;cout<<"ttt1表示房屋"<<endl;cout<<"ttt2 表示顧客"<<endl;cin>>flag4;if(flag4=1)House H;H.select ();else if(flag4=2)Customer C;C.select ();else cout<<"輸入錯(cuò)誤! "<<endl;break;case 2:cout<<setw(35)<<" 選擇操作:"<<endl;cout<<"ttt1表示對(duì)房屋操作&qu
溫馨提示
- 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ì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 2026年職業(yè)倦怠綜合測(cè)試(職業(yè)倦怠預(yù)防)試題及答案
- 2026年口腔科(種植牙案例)試題及答案
- 2025年中職(旅游服務(wù)與管理)旅游市場(chǎng)實(shí)訓(xùn)綜合測(cè)試題及答案
- 2025年高職(會(huì)計(jì))成本會(huì)計(jì)實(shí)訓(xùn)階段測(cè)試題及答案
- 2025年高職(林業(yè)技術(shù))森林管護(hù)技術(shù)試題及答案
- 巴爾蒂斯介紹
- 養(yǎng)老院老人營(yíng)養(yǎng)膳食制度
- 養(yǎng)老院老人生活?yuàn)蕵?lè)活動(dòng)組織人員激勵(lì)制度
- 養(yǎng)老院老人家庭溝通制度
- 養(yǎng)老院緊急情況處理制度
- DB31T+1661-2025公共區(qū)域電子屏播控安全管理要求
- 醫(yī)療聯(lián)合體兒童保健服務(wù)模式創(chuàng)新
- 2026年書記員考試題庫(kù)附答案
- 中國(guó)高尿酸血癥與痛風(fēng)診療指南(2024更新版)課件
- 2025至2030中國(guó)專用車行業(yè)發(fā)展分析及投資前景與戰(zhàn)略規(guī)劃報(bào)告
- DB13∕T 6066.3-2025 國(guó)資數(shù)智化 第3部分:數(shù)據(jù)治理規(guī)范
- 2025年白山輔警招聘考試題庫(kù)及答案1套
- 特種設(shè)備外借協(xié)議書
- 三元股份財(cái)務(wù)風(fēng)險(xiǎn)控制研究
- DBJ-T 13-417-2023 工程泥漿技術(shù)標(biāo)準(zhǔn)
- 湖南省長(zhǎng)沙市雅禮教育集團(tuán)2024-2025學(xué)年七年級(jí)(下)期末數(shù)學(xué)試卷
評(píng)論
0/150
提交評(píng)論