C++實(shí)現(xiàn)簡(jiǎn)單酒店管理系統(tǒng)
本文實(shí)例為大家分享了C++實(shí)現(xiàn)簡(jiǎn)單酒店管理系統(tǒng)的具體代碼,供大家參考,具體內(nèi)容如下
酒店管理系統(tǒng)設(shè)計(jì)報(bào)告
一、 需求分析
題目要求如下:
某酒店有客房若干間,其中客房分為不同等級(jí),如豪華、標(biāo)準(zhǔn)、普通等,客房床位數(shù)也不同。例如,豪華套房有4個(gè)床位,400元/晚;標(biāo)準(zhǔn)客房2個(gè)床位,200元/晚;普通客房1個(gè)床位,100元/晚。
顧客分金卡會(huì)員、銀卡會(huì)員、普通會(huì)員及非會(huì)員,其享受的折扣不同。例如,金卡會(huì)員可享受8折優(yōu)惠,銀卡會(huì)員可享受9折優(yōu)惠,普通會(huì)員享受95折優(yōu)惠,非會(huì)員不享受優(yōu)惠。
當(dāng)顧客連續(xù)入住多天時(shí),也可享受一定的折扣。例如,當(dāng)顧客連續(xù)入住24晚時(shí),可享受9折優(yōu)惠;連續(xù)入住58晚時(shí),可享受85折優(yōu)惠;連續(xù)入住9晚以上時(shí),可享受8折優(yōu)惠。
采用面向?qū)ο蟮乃枷?,建立系統(tǒng)中清晰的類,分析和定義各個(gè)類,每個(gè)類中要有各自的屬性和方法,并開(kāi)發(fā)一套客房管理系統(tǒng),實(shí)現(xiàn)如下功能:
(1) 管理員:以管理員身份登錄系統(tǒng),查詢當(dāng)前客房入住及預(yù)訂情況,并設(shè)置客房?jī)r(jià)格、顧客優(yōu)惠政策等;
(2) 酒店前臺(tái):以前臺(tái)身份登錄系統(tǒng),查詢當(dāng)前客房入住及預(yù)訂情況,為顧客辦理入住、退房、換房等服務(wù);顧客退房后為顧客計(jì)算消費(fèi)金額并收費(fèi);
(3) 顧客:可以注冊(cè)和登錄系統(tǒng),用戶在查找到心儀的客房后,登錄酒店客房管理系統(tǒng)可提交訂單實(shí)現(xiàn)客房預(yù)訂;未入住酒店前1天,可取消客房預(yù)訂;顧客入住退房后可評(píng)論。
二、 類圖設(shè)計(jì)及說(shuō)明



這里的customer類名打錯(cuò)了

三、 系統(tǒng)功能設(shè)計(jì)
1、系統(tǒng)可以三種用戶登錄,分別為管理員、前臺(tái)工作人員、客戶,管理員需要特殊管理員賬戶才可以登錄,客戶需要注冊(cè)賬號(hào)才可以登錄系統(tǒng),用戶登錄成功后轉(zhuǎn)至前臺(tái)工作人員為其服務(wù)。
2、 管理人員頁(yè)面有查詢房間狀態(tài),設(shè)置優(yōu)惠政策,新建房間等選項(xiàng)。
① 查詢房間狀態(tài):返回所有房間號(hào),房間類型和當(dāng)前狀態(tài)
② 設(shè)置優(yōu)惠政策:對(duì)已有的區(qū)間設(shè)置打折力度
③ 新建房間:通過(guò)房間號(hào)和房間類型來(lái)新建房間
3、 前臺(tái)頁(yè)面提供客房查詢,辦理入住,提前預(yù)約,辦理退房等功能
① 查詢客房信息:向用戶提供房間信息來(lái)選擇。
② 辦理入?。韩@取用戶入住時(shí)間和離開(kāi)時(shí)間為客戶辦理入住。
③ 提前預(yù)約:獲取用戶入住時(shí)間和離開(kāi)時(shí)間為客戶提前預(yù)約。
④ 辦理退房:獲取退房房間號(hào),辦理退房并且返回客戶需付費(fèi)金額。
4、客戶界面,無(wú)賬號(hào)注冊(cè)賬號(hào),通過(guò)賬號(hào)密碼的形式登錄,登錄成功后轉(zhuǎn)至前臺(tái)頁(yè)面。
四、實(shí)現(xiàn)流程

五、 結(jié)果演示
1、 首頁(yè)

2、 管理員
登錄管理員頁(yè)面

創(chuàng)建房間


依次創(chuàng)建五個(gè)房間(創(chuàng)建數(shù)量小于40)
可查詢當(dāng)前的狀態(tài)

設(shè)置優(yōu)惠政策

3、 前臺(tái)
查詢當(dāng)前房間狀態(tài)

輸入入住時(shí)間和退房時(shí)間,會(huì)顯示當(dāng)前房間狀態(tài),可進(jìn)行選擇,選擇后會(huì)更具入住時(shí)間長(zhǎng)短顯示客戶所享受的優(yōu)惠政策,8折(此前在管理員狀態(tài)設(shè)置過(guò))

房間狀態(tài)變?yōu)橛锌?/p>

若入住有客的房間,會(huì)顯示已經(jīng)有客人了,選擇其他房間

預(yù)約房間也是同理

并且房間變成已經(jīng)被預(yù)約

退房,入住7天豪華房間400x7=2800,但是享受8折,因此收費(fèi)2240,繳費(fèi)后可以留下評(píng)論

并且此時(shí)房間狀態(tài)也變成了空

4、 客戶
客戶平臺(tái)

注冊(cè)賬號(hào)

登錄賬號(hào),登錄成功轉(zhuǎn)到前臺(tái)

如果輸入不存在的賬號(hào),會(huì)報(bào)錯(cuò)

六、 問(wèn)題及解決
中途遇見(jiàn)了一個(gè)問(wèn)題想了很久,客戶請(qǐng)求入住后通過(guò)reception類入住,reception類中是通過(guò)改變r(jià)oom類型實(shí)現(xiàn)的,然而每次入住后房間的狀態(tài)在reception類中已經(jīng)改變,卻在查詢時(shí)沒(méi)有變化,最后將reception類的checkin函數(shù)改為返回room類型才成功,當(dāng)然預(yù)約和退房也是同理。原來(lái)客戶提交的申請(qǐng)?jiān)趓eception類中創(chuàng)建一個(gè)新的room,并不是我們想要操作的room,因此需要返回修改后的房間才可以得到正確的結(jié)果。
七、 附錄
設(shè)計(jì)代碼如下:
#include<iostream>
using namespace std;
#include<string>
enum Type { luxury, standard, ordinary };
enum Status { used, reserved, empty1 };
struct Time {
? ? int year;
? ? int month;
? ? int day;
};
class room {
public:
? ? room(int roomNo, Type roomType) {
? ? ? ? roomID = roomNo;
? ? ? ? type = roomType;
? ? ? ? roomStatus = empty1;
? ? ? ? if (type == luxury) {
? ? ? ? ? ? price = 400;
? ? ? ? ? ? name = "豪華間";
? ? ? ? }
? ? ? ? else if (type == standard) {
? ? ? ? ? ? price = 200;
? ? ? ? ? ? name = "標(biāo)準(zhǔn)間";
? ? ? ? }
? ? ? ? else if (type == ordinary) {
? ? ? ? ? ? price = 100;
? ? ? ? ? ? name = "普通間";
? ? ? ? }
? ? };
? ? room() {};
? ? //顯示房間當(dāng)前信息
? ? void showInformation() {
? ? ? ? cout << "房間號(hào):" << roomID << endl;
? ? ? ? cout << "類型:" << name << endl;
? ? ? ? if(roomStatus == 0)
? ? ? ? ? ? cout << "當(dāng)前狀態(tài):有客" <<endl;
? ? ? ? else if(roomStatus == 1)
? ? ? ? ? ? cout << "當(dāng)前狀態(tài):已被預(yù)約" << endl;
? ? ? ? else
? ? ? ? ? ? cout << "當(dāng)前狀態(tài):空房間" << endl;
? ? ? ? cout << endl;
? ? }
? ? //辦理入住
? ? void checkIn(Time beginTime, Time endTime) {
? ? ? ? this->begin = beginTime;
? ? ? ? this->end = endTime;
? ? ? ? this->roomStatus = used;
? ? }
? ? void roomReserved(Time beginTime, Time endTime) {
? ? ? ? roomStatus = reserved;
? ? ? ? begin = beginTime;
? ? ? ? end = endTime;
? ? };
? ? //辦理退房
? ? float checkOut() {
? ? ? ? roomStatus = empty1;
? ? ? ? int day = (end.year - begin.year) * 365 + (end.month - begin.month) * 30 + (end.day - begin.day);
? ? ? ? float polity;
? ? ? ? if (day > 2 && day <= 4) {
? ? ? ? ? ? polity = polity1;
? ? ? ? }
? ? ? ? else if (day >= 5 && day <= 8) {
? ? ? ? ? ? polity = polity2;
? ? ? ? }
? ? ? ? else if (day >= 9) {
? ? ? ? ? ? polity = polity3;
? ? ? ? }
? ? ? ? else {
? ? ? ? ? ? polity = 1;
? ? ? ? }
? ? ? ? float money = ((end.year - begin.year) * 365 + (end.month - begin.month) * 30 + (end.day - begin.day))*price*polity;
? ? ? ? return money;
? ? }
? ? int showstatus() {
? ? ? ? return roomStatus;
? ? }
? ? int getRno(){
? ? ? ? return roomID;
? ? }
? ? void setPolity(float a, float b, float c) {
? ? ? ? polity1 = a;
? ? ? ? polity2 = b;
? ? ? ? polity3 = c; ? ? ? ?
? ? }
? ? int getRoomnumber() {
? ? ? ? return roomnumber;
? ? }
? ? friend class manager;
? ? friend class reception;
private:
? ? int roomID;
? ? static float polity1;
? ? static float polity2;
? ? static float polity3;
? ? static int roomnumber;
? ? Type type;
? ? string name;
? ? float price;
? ? Status roomStatus;
? ? Time begin;
? ? Time end;
};
class manager {
public:
? ? manager() {};
? ? room roomcreate(int No, Type roomtype) {
? ? ? ? room Room(No, roomtype);
? ? ? ? Room.roomnumber++;
? ? ? ? return Room;
? ? }
? ? void checkInformation(room Room) {
? ? ? ? Room.showInformation();
? ? }
? ? void setPolity() {
? ? ? ? room Room1;
? ? ? ? float a, b, c;
? ? ? ? cout << "請(qǐng)分別設(shè)置入住2-4天,5-8天或9天以上的優(yōu)惠政策,用1以內(nèi)小數(shù)表示打折力度" << endl;
? ? ? ? cin >> a >> b >> c;
? ? ? ? Room1.setPolity(a, b, c);
? ? ? ? cout << "設(shè)置成功" << endl;
? ? };
};
class reception {
public:
? ? reception(int no) {
? ? ? ? NO = no;
? ? }
? ? void checkInformation(room Room) {
? ? ? ? Room.showInformation();
? ? }
? ? room CheckIn(Time begin, Time end, room Room) {
? ? ? ? if (Room.showstatus() == empty1) {
? ? ? ? ? ? Room.checkIn(begin, end);
? ? ? ? ? ? cout << "預(yù)定成功!時(shí)間:" << begin.year << "年" << begin.month << "月" << begin.day << "日---" << end.year << "年" << end.month << "月" << end.day << "日" << endl;
? ? ? ? ? ? int day = (end.year - begin.year) * 365 + (end.month - begin.month) * 30 + (end.day - begin.day);
? ? ? ? ? ? if (day > 2 && day <= 4) {
? ? ? ? ? ? ? ? polity = Room.polity1;
? ? ? ? ? ? }
? ? ? ? ? ? else if (day >= 5 && day <= 8) {
? ? ? ? ? ? ? ? polity = Room.polity2;
? ? ? ? ? ? }
? ? ? ? ? ? else if (day >= 9) {
? ? ? ? ? ? ? ? polity = Room.polity3;
? ? ? ? ? ? }
? ? ? ? ? ? else {
? ? ? ? ? ? ? ? polity = 1;
? ? ? ? ? ? }
? ? ? ? ? ? if (polity < 1)
? ? ? ? ? ? ? ? cout << "優(yōu)惠打" << polity * 10 << "折" << endl;
? ? ? ? }
? ? ? ? else {
? ? ? ? ? ? cout << "房間已經(jīng)被預(yù)定,請(qǐng)選擇其他房間" << endl;
? ? ? ? }
? ? ? ? return Room;
? ? }
? ? int getID() {
? ? ? ? return NO;
? ? }
? ? room CheckOut(room Room) {
? ? ? ? float money = Room.checkOut();
? ? ? ? cout << "退房成功" << endl;
? ? ? ? cout << "請(qǐng)支付:" << money << "元"<<endl;
? ? ? ? return Room;
? ? }
? ? room Reserved(Time begin, Time end, room Room) {
? ? ? ? if (Room.showstatus() == empty1) {
? ? ? ? ? ? Room.roomReserved(begin, end);
? ? ? ? ? ? cout << "預(yù)定成功!時(shí)間:" << begin.year << "年" << begin.month << "月" << begin.year << "日---" << end.year << "年" << end.month << "月" << end.day << "日" << endl;
? ? ? ? ? ? int day = (end.year - begin.year) * 365 + (end.month - begin.month) * 30 + (end.day - begin.day);
? ? ? ? ? ? if (day > 2 && day <= 4) {
? ? ? ? ? ? ? ? polity = Room.polity1;
? ? ? ? ? ? }
? ? ? ? ? ? else if (day >= 5 && day <= 8) {
? ? ? ? ? ? ? ? polity = Room.polity2;
? ? ? ? ? ? }
? ? ? ? ? ? else if (day >= 9) {
? ? ? ? ? ? ? ? polity = Room.polity3;
? ? ? ? ? ? }
? ? ? ? ? ? else {
? ? ? ? ? ? ? ? polity = 1;
? ? ? ? ? ? }
? ? ? ? ? ? if (polity < 1)
? ? ? ? ? ? ? ? cout << "優(yōu)惠打" << polity * 10 << "折" << endl;
? ? ? ? }
? ? ? ? else {
? ? ? ? ? ? cout << "房間已經(jīng)被預(yù)定,請(qǐng)選擇其他房間" << endl;
? ? ? ? }
? ? ? ? return Room;
? ? }
private:
? ? int NO;
? ? float polity;
};
class customer {
public:
? ? customer(){}
? ? customer(int Count, int Key) {
? ? ? ? count = Count;
? ? ? ? key = Key;
? ? ? ? customernumber++;
? ? ? ? cout << "注冊(cè)成功!" << endl;
? ? }
? ? void signin() {};
? ? void checkin(reception rec, Time begin, Time end, room Room) {
? ? ? ? rec.CheckIn(begin, end, Room);
? ? }
? ? void reserve(reception rec, Time begin, Time end, room Room) {
? ? ? ? rec.Reserved(begin, end, Room);
? ? }
? ? void ?checkout(reception rec, room Room) {
? ? ? ? rec.CheckOut(Room);
? ? }
? ? int getnumber() {
? ? ? ? return customernumber;
? ? }
? ? int getcount() {
? ? ? ? return count;
? ? }
? ? int getkey() {
? ? ? ? return key;
? ? }
private:
? ? int count;
? ? int key;
? ? static int customernumber;
};
int room::roomnumber = 0;
int customer::customernumber = 0;
float room::polity1 = 1;
float room::polity2 = 1;
float room::polity3 = 1;
int main() {
? ? int user;
? ? int rightkey = 123;
? ? manager jasur;
? ? reception wmn(1);
? ? room Baseroom;
? ? room Room[40];
? ? customer Customer[40];
? ? customer baseCusomer;
? ? string comments[40];
? ? while (true) {
? ? ? ? cout << "歡迎來(lái)到酒店預(yù)訂系統(tǒng),請(qǐng)問(wèn)你是?" << endl;
? ? ? ? cout << "1.管理員 ?2.前臺(tái) ? 3.客戶" << endl;
? ? ? ? cout << "請(qǐng)輸入:" << endl;
? ? ? ? cin >> user;
? ? ? ? if (user == 1) { ? ?//管理員選項(xiàng)
? ? ? ? ? ? cout << "請(qǐng)輸入管理員密碼:" << endl;
? ? ? ? ? ? int key;
? ? ? ? ? ? cin >> key;
? ? ? ? ? ? if (rightkey == key) {
? ? ? ? ? ? ? ? cout << "歡迎來(lái)到管理員平臺(tái)歡迎您!" << endl;
? ? ? ? ? ? ? ? while (true) {
? ? ? ? ? ? ? ? ? ? cout << "1.查詢?nèi)胱∏闆r ? 2.設(shè)置客房?jī)?yōu)惠 ?3.創(chuàng)建房間 ?0.退出" << endl;
? ? ? ? ? ? ? ? ? ? int selection;
? ? ? ? ? ? ? ? ? ? cout << "請(qǐng)輸入:" << endl;
? ? ? ? ? ? ? ? ? ? cin >> selection;
? ? ? ? ? ? ? ? ? ? if (selection == 1) {
? ? ? ? ? ? ? ? ? ? ? ? for (int i = 0; i < Baseroom.getRoomnumber(); i++) {
? ? ? ? ? ? ? ? ? ? ? ? ? ? jasur.checkInformation(Room[i + 1]);
? ? ? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? else if (selection == 2) {
? ? ? ? ? ? ? ? ? ? ? ? jasur.setPolity();
? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? else if (selection == 3) {
? ? ? ? ? ? ? ? ? ? ? ? int entry, Rno;
? ? ? ? ? ? ? ? ? ? ? ? cout << "輸入創(chuàng)建房間的房間號(hào)和類型(1代表豪華間,2代表標(biāo)準(zhǔn)間,3代表普通間)" << endl;
? ? ? ? ? ? ? ? ? ? ? ? cin >> Rno >> entry;
? ? ? ? ? ? ? ? ? ? ? ? if (entry == 1)
? ? ? ? ? ? ? ? ? ? ? ? ? ? Room[Baseroom.getRoomnumber()] = jasur.roomcreate(Rno, luxury);
? ? ? ? ? ? ? ? ? ? ? ? else if (entry == 2)
? ? ? ? ? ? ? ? ? ? ? ? ? ? Room[Baseroom.getRoomnumber()] = jasur.roomcreate(Rno, standard);
? ? ? ? ? ? ? ? ? ? ? ? else if (entry == 3)
? ? ? ? ? ? ? ? ? ? ? ? ? ? Room[Baseroom.getRoomnumber()] = jasur.roomcreate(Rno, ordinary);
? ? ? ? ? ? ? ? ? ? ? ? cout << "操作成功" << endl << endl;
? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? else if (selection == 0) {
? ? ? ? ? ? ? ? ? ? ? ? break;
? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? }
? ? ? ? ? ? }
? ? ? ? }
? ? ? ? else if (user == 2) {
? ? ? ? ? ? cout << "歡迎來(lái)到前臺(tái)服務(wù)平臺(tái)" << endl;
? ? ? ? ? ? while (true) {
? ? ? ? ? ? ? ? fuwu:
? ? ? ? ? ? ? ? cout << wmn.getID() << "號(hào)服務(wù)員為您服務(wù),本平臺(tái)為您提供了如下功能:1.查詢客房信息 ?2.辦理入住 ?3.提前預(yù)約 ?4.辦理退房 ?0.退出" << endl;
? ? ? ? ? ? ? ? cout << "請(qǐng)選擇需要的服務(wù)" << endl;
? ? ? ? ? ? ? ? int selection;
? ? ? ? ? ? ? ? cin >> selection;
? ? ? ? ? ? ? ? if (selection == 1) {
? ? ? ? ? ? ? ? ? ? cout << "客房信息如下:" << endl;
? ? ? ? ? ? ? ? ? ? for (int i = 0; i < Baseroom.getRoomnumber(); i++) {
? ? ? ? ? ? ? ? ? ? ? ? wmn.checkInformation(Room[i + 1]);
? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? else if (selection == 2) {
? ? ? ? ? ? ? ? ? ? Time begin, end;
? ? ? ? ? ? ? ? ? ? int Rno, index;
? ? ? ? ? ? ? ? ? ? cout << "輸入客戶入住時(shí)間:";
? ? ? ? ? ? ? ? ? ? cin >> begin.year >> begin.month >> begin.day;
? ? ? ? ? ? ? ? ? ? cout << "輸入客戶離開(kāi)時(shí)間:";
? ? ? ? ? ? ? ? ? ? cin >> end.year >> end.month >> end.day;
? ? ? ? ? ? ? ? ? ? cout << "客房信息如下:" << endl;
? ? ? ? ? ? ? ? ? ? for (int i = 0; i < Baseroom.getRoomnumber(); i++) {
? ? ? ? ? ? ? ? ? ? ? ? wmn.checkInformation(Room[i + 1]);
? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? cout << "請(qǐng)輸入入住客房號(hào):";
? ? ? ? ? ? ? ? ? ? cin >> Rno;
? ? ? ? ? ? ? ? ? ? for (int i = 0; i < Baseroom.getRoomnumber(); i++) {
? ? ? ? ? ? ? ? ? ? ? ? if (Room[i + 1].getRno() == Rno) {
? ? ? ? ? ? ? ? ? ? ? ? ? ? index = i + 1;
? ? ? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? Room[index] = wmn.CheckIn(begin, end, Room[index]);
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? else if (selection == 3) {
? ? ? ? ? ? ? ? ? ? Time begin, end;
? ? ? ? ? ? ? ? ? ? int Rno, index;
? ? ? ? ? ? ? ? ? ? cout << "輸入客戶入住時(shí)間:";
? ? ? ? ? ? ? ? ? ? cin >> begin.year >> begin.month >> begin.day;
? ? ? ? ? ? ? ? ? ? cout << "輸入客戶離開(kāi)時(shí)間:";
? ? ? ? ? ? ? ? ? ? cin >> end.year >> end.month >> end.day;
? ? ? ? ? ? ? ? ? ? cout << "客房信息如下:" << endl;
? ? ? ? ? ? ? ? ? ? for (int i = 0; i < Baseroom.getRoomnumber(); i++) {
? ? ? ? ? ? ? ? ? ? ? ? wmn.checkInformation(Room[i + 1]);
? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? cout << "請(qǐng)輸入預(yù)約客房號(hào):";
? ? ? ? ? ? ? ? ? ? cin >> Rno;
? ? ? ? ? ? ? ? ? ? for (int i = 0; i < Baseroom.getRoomnumber(); i++) {
? ? ? ? ? ? ? ? ? ? ? ? if (Room[i + 1].getRno() == Rno) {
? ? ? ? ? ? ? ? ? ? ? ? ? ? index = i + 1;
? ? ? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? Room[index] = wmn.Reserved(begin, end, Room[index]);
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? else if (selection == 4) {
? ? ? ? ? ? ? ? ? ? int Rno,index;
? ? ? ? ? ? ? ? ? ? cout << "請(qǐng)輸入退房房間號(hào):";
? ? ? ? ? ? ? ? ? ? cin >> Rno;
? ? ? ? ? ? ? ? ? ? for (int i = 0; i < Baseroom.getRoomnumber(); i++) {
? ? ? ? ? ? ? ? ? ? ? ? if (Room[i + 1].getRno() == Rno) {
? ? ? ? ? ? ? ? ? ? ? ? ? ? index = i + 1;
? ? ? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? Room[index] = wmn.CheckOut(Room[index]);
? ? ? ? ? ? ? ? ? ? cout << "歡迎留言評(píng)論您的體驗(yàn):" << endl;
? ? ? ? ? ? ? ? ? ? cin >> comments[index];
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? else if (selection == 0) {
? ? ? ? ? ? ? ? ? ? break;
? ? ? ? ? ? ? ? }
? ? ? ? ? ? }
? ? ? ? }
? ? ? ? else if (user == 3) {
? ? ? ? ? ? cout << "用戶你好,歡迎您來(lái)到本酒店" << endl;
? ? ? ? ? ? while (true) {
? ? ? ? ? ? ? ? cout << "請(qǐng)問(wèn)您有本平臺(tái)的賬號(hào)嗎?沒(méi)有可以注冊(cè)一個(gè)哦!" << endl;
? ? ? ? ? ? ? ? cout << "1.我已經(jīng)有賬號(hào)了 ? ?2.注冊(cè) ? ? 0.退出" << endl;
? ? ? ? ? ? ? ? int selection;
? ? ? ? ? ? ? ? cin >> selection;
? ? ? ? ? ? ? ? if (selection == 1) {
? ? ? ? ? ? ? ? ? ? int count, key, rightcount, index = -1;
? ? ? ? ? ? ? ? x:
? ? ? ? ? ? ? ? ? ? cout << "請(qǐng)輸入賬號(hào):" << endl;
? ? ? ? ? ? ? ? ? ? cin >> count;
? ? ? ? ? ? ? ? ? ? for (int i = 0; i < baseCusomer.getnumber(); i++) {
? ? ? ? ? ? ? ? ? ? ? ? if (Customer[i].getcount() == count) {
? ? ? ? ? ? ? ? ? ? ? ? ? ? index = i;
? ? ? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? if (index == -1) {
? ? ? ? ? ? ? ? ? ? ? ? cout << "不存在此賬號(hào)" << endl;
? ? ? ? ? ? ? ? ? ? ? ? goto x;
? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? y:
? ? ? ? ? ? ? ? ? ? cout << "請(qǐng)輸入密碼:";
? ? ? ? ? ? ? ? ? ? cin >> key;
? ? ? ? ? ? ? ? ? ? for (int i = 0; i < baseCusomer.getnumber(); i++) {
? ? ? ? ? ? ? ? ? ? ? ? if (Customer[index].getkey() == key) {
? ? ? ? ? ? ? ? ? ? ? ? ? ? cout << "登錄成功!" << endl;
? ? ? ? ? ? ? ? ? ? ? ? ? ? goto fuwu;
? ? ? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? ? ? else {
? ? ? ? ? ? ? ? ? ? ? ? ? ? cout << "密碼錯(cuò)誤!" << endl;
? ? ? ? ? ? ? ? ? ? ? ? ? ? goto y;
? ? ? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? else if (selection == 2) {
? ? ? ? ? ? ? ? ? ? int count, key, virity;
? ? ? ? ? ? ? ? ? ? cout << "請(qǐng)輸入注冊(cè)賬號(hào):";
? ? ? ? ? ? ? ? ? ? cin >> count;
? ? ? ? ? ? ? ? ? ? cout << endl;
? ? ? ? ? ? ? ? a:
? ? ? ? ? ? ? ? ? ? cout << "請(qǐng)?jiān)O(shè)置密碼:";
? ? ? ? ? ? ? ? ? ? cin >> key;
? ? ? ? ? ? ? ? ? ? cout << "請(qǐng)確認(rèn)密碼:";
? ? ? ? ? ? ? ? ? ? cin >> virity;
? ? ? ? ? ? ? ? ? ? if (key == virity) {
? ? ? ? ? ? ? ? ? ? ? ? customer base(count, key);
? ? ? ? ? ? ? ? ? ? ? ? Customer[baseCusomer.getnumber() - 1] = base;
? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? else {
? ? ? ? ? ? ? ? ? ? ? ? cout << "兩次密碼不相等,重新輸入" << endl;
? ? ? ? ? ? ? ? ? ? ? ? goto a;
? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? else if (selection == 0) {
? ? ? ? ? ? ? ? ? ? break;
? ? ? ? ? ? ? ? }
? ? ? ? ? ? }
? ? ? ? }
? ? ? ? else {
? ? ? ? ? ? cout << "無(wú)效的選擇,重新選擇!";
? ? ? ? }
? ? }
? ? return 0;
}以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
相關(guān)文章
淺析VSCode tasks.json中的各種替換變量的意思 ${workspaceFolder} ${file} ${
這篇文章主要介紹了關(guān)于VSCode tasks.json中的各種替換變量的意思 ${workspaceFolder} ${file} ${fileBasename} ${fileDirname}等,本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有參考借鑒價(jià)值,需要的朋友可以參考下2020-03-03
C/C++數(shù)據(jù)對(duì)齊詳細(xì)解析
通常我們?cè)趯?xiě)代碼的時(shí)候是不需要考慮對(duì)齊的影響的,都是依賴編譯器來(lái)為我們選擇適合的對(duì)齊策略,我們也可以通過(guò)傳遞給編譯器預(yù)編譯指令來(lái)指定數(shù)據(jù)對(duì)齊的方法2013-10-10
基于MFC和OpenCV實(shí)現(xiàn)角點(diǎn)檢測(cè)
這篇文章主要為大家詳細(xì)介紹了基于MFC和OpenCV實(shí)現(xiàn)角點(diǎn)檢測(cè),文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下2019-03-03
static_cast,dynamic_cast,reinterpret_cast和const_cast的區(qū)別詳解
以下是對(duì)static_cast,dynamic_cast,reinterpret_cast和const_cast之間的區(qū)別進(jìn)行了詳細(xì)的介紹,需要的朋友可以過(guò)來(lái)參考下2013-09-09
利用反射獲得類的public static/const成員的值實(shí)例
下面小編就為大家?guī)?lái)一篇利用反射獲得類的public static/const成員的值實(shí)例。小編覺(jué)得挺不錯(cuò)的,現(xiàn)在就分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧2016-12-12
海量數(shù)據(jù)處理系列之:用C++實(shí)現(xiàn)Bitmap算法
本篇文章是對(duì)用C++實(shí)現(xiàn)Bitmap算法進(jìn)行了詳細(xì)的分析介紹,需要的朋友參考下2013-05-05

