亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

C++實現(xiàn)簡單酒店管理系統(tǒng)

 更新時間:2022年08月31日 10:44:15   作者:J@sur  
這篇文章主要為大家詳細介紹了C++實現(xiàn)簡單酒店管理系統(tǒng),文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下

本文實例為大家分享了C++實現(xiàn)簡單酒店管理系統(tǒng)的具體代碼,供大家參考,具體內(nèi)容如下

酒店管理系統(tǒng)設(shè)計報告

一、 需求分析

題目要求如下:

某酒店有客房若干間,其中客房分為不同等級,如豪華、標準、普通等,客房床位數(shù)也不同。例如,豪華套房有4個床位,400元/晚;標準客房2個床位,200元/晚;普通客房1個床位,100元/晚。

顧客分金卡會員、銀卡會員、普通會員及非會員,其享受的折扣不同。例如,金卡會員可享受8折優(yōu)惠,銀卡會員可享受9折優(yōu)惠,普通會員享受95折優(yōu)惠,非會員不享受優(yōu)惠。

當(dāng)顧客連續(xù)入住多天時,也可享受一定的折扣。例如,當(dāng)顧客連續(xù)入住24晚時,可享受9折優(yōu)惠;連續(xù)入住58晚時,可享受85折優(yōu)惠;連續(xù)入住9晚以上時,可享受8折優(yōu)惠。

采用面向?qū)ο蟮乃枷耄⑾到y(tǒng)中清晰的類,分析和定義各個類,每個類中要有各自的屬性和方法,并開發(fā)一套客房管理系統(tǒng),實現(xiàn)如下功能:

(1) 管理員:以管理員身份登錄系統(tǒng),查詢當(dāng)前客房入住及預(yù)訂情況,并設(shè)置客房價格、顧客優(yōu)惠政策等;
(2) 酒店前臺:以前臺身份登錄系統(tǒng),查詢當(dāng)前客房入住及預(yù)訂情況,為顧客辦理入住、退房、換房等服務(wù);顧客退房后為顧客計算消費金額并收費;
(3) 顧客:可以注冊和登錄系統(tǒng),用戶在查找到心儀的客房后,登錄酒店客房管理系統(tǒng)可提交訂單實現(xiàn)客房預(yù)訂;未入住酒店前1天,可取消客房預(yù)訂;顧客入住退房后可評論。

二、 類圖設(shè)計及說明

在這里插入圖片描述

在這里插入圖片描述

這里的customer類名打錯了

三、 系統(tǒng)功能設(shè)計

1、系統(tǒng)可以三種用戶登錄,分別為管理員、前臺工作人員、客戶,管理員需要特殊管理員賬戶才可以登錄,客戶需要注冊賬號才可以登錄系統(tǒng),用戶登錄成功后轉(zhuǎn)至前臺工作人員為其服務(wù)。

2、 管理人員頁面有查詢房間狀態(tài),設(shè)置優(yōu)惠政策,新建房間等選項。

① 查詢房間狀態(tài):返回所有房間號,房間類型和當(dāng)前狀態(tài)
② 設(shè)置優(yōu)惠政策:對已有的區(qū)間設(shè)置打折力度
③ 新建房間:通過房間號和房間類型來新建房間

3、 前臺頁面提供客房查詢,辦理入住,提前預(yù)約,辦理退房等功能

① 查詢客房信息:向用戶提供房間信息來選擇。
② 辦理入?。韩@取用戶入住時間和離開時間為客戶辦理入住。
③ 提前預(yù)約:獲取用戶入住時間和離開時間為客戶提前預(yù)約。
④ 辦理退房:獲取退房房間號,辦理退房并且返回客戶需付費金額。

4、客戶界面,無賬號注冊賬號,通過賬號密碼的形式登錄,登錄成功后轉(zhuǎn)至前臺頁面。

四、實現(xiàn)流程

在這里插入圖片描述

五、 結(jié)果演示

1、 首頁

在這里插入圖片描述

2、 管理員

登錄管理員頁面

在這里插入圖片描述

創(chuàng)建房間

在這里插入圖片描述

在這里插入圖片描述

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

在這里插入圖片描述

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

在這里插入圖片描述

3、 前臺

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

在這里插入圖片描述

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

在這里插入圖片描述

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

在這里插入圖片描述

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

在這里插入圖片描述

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

在這里插入圖片描述

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

在這里插入圖片描述

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

在這里插入圖片描述

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

在這里插入圖片描述

4、 客戶

客戶平臺

在這里插入圖片描述

注冊賬號

在這里插入圖片描述

登錄賬號,登錄成功轉(zhuǎn)到前臺

在這里插入圖片描述

如果輸入不存在的賬號,會報錯

在這里插入圖片描述

六、 問題及解決

中途遇見了一個問題想了很久,客戶請求入住后通過reception類入住,reception類中是通過改變room類型實現(xiàn)的,然而每次入住后房間的狀態(tài)在reception類中已經(jīng)改變,卻在查詢時沒有變化,最后將reception類的checkin函數(shù)改為返回room類型才成功,當(dāng)然預(yù)約和退房也是同理。原來客戶提交的申請在reception類中創(chuàng)建一個新的room,并不是我們想要操作的room,因此需要返回修改后的房間才可以得到正確的結(jié)果。

七、 附錄

設(shè)計代碼如下:

#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 = "標準間";
? ? ? ? }
? ? ? ? else if (type == ordinary) {
? ? ? ? ? ? price = 100;
? ? ? ? ? ? name = "普通間";
? ? ? ? }
? ? };
? ? room() {};
? ? //顯示房間當(dāng)前信息
? ? void showInformation() {
? ? ? ? cout << "房間號:" << 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 << "請分別設(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ù)定成功!時間:" << 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ù)定,請選擇其他房間" << endl;
? ? ? ? }
? ? ? ? return Room;
? ? }
? ? int getID() {
? ? ? ? return NO;
? ? }
? ? room CheckOut(room Room) {
? ? ? ? float money = Room.checkOut();
? ? ? ? cout << "退房成功" << endl;
? ? ? ? cout << "請支付:" << money << "元"<<endl;
? ? ? ? return Room;
? ? }
? ? room Reserved(Time begin, Time end, room Room) {
? ? ? ? if (Room.showstatus() == empty1) {
? ? ? ? ? ? Room.roomReserved(begin, end);
? ? ? ? ? ? cout << "預(yù)定成功!時間:" << 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ù)定,請選擇其他房間" << endl;
? ? ? ? }
? ? ? ? return Room;
? ? }
private:
? ? int NO;
? ? float polity;
};

class customer {
public:
? ? customer(){}
? ? customer(int Count, int Key) {
? ? ? ? count = Count;
? ? ? ? key = Key;
? ? ? ? customernumber++;
? ? ? ? cout << "注冊成功!" << 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 << "歡迎來到酒店預(yù)訂系統(tǒng),請問你是?" << endl;
? ? ? ? cout << "1.管理員 ?2.前臺 ? 3.客戶" << endl;
? ? ? ? cout << "請輸入:" << endl;
? ? ? ? cin >> user;
? ? ? ? if (user == 1) { ? ?//管理員選項
? ? ? ? ? ? cout << "請輸入管理員密碼:" << endl;
? ? ? ? ? ? int key;
? ? ? ? ? ? cin >> key;
? ? ? ? ? ? if (rightkey == key) {
? ? ? ? ? ? ? ? cout << "歡迎來到管理員平臺歡迎您!" << endl;
? ? ? ? ? ? ? ? while (true) {
? ? ? ? ? ? ? ? ? ? cout << "1.查詢?nèi)胱∏闆r ? 2.設(shè)置客房優(yōu)惠 ?3.創(chuàng)建房間 ?0.退出" << endl;
? ? ? ? ? ? ? ? ? ? int selection;
? ? ? ? ? ? ? ? ? ? cout << "請輸入:" << 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)建房間的房間號和類型(1代表豪華間,2代表標準間,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 << "歡迎來到前臺服務(wù)平臺" << endl;
? ? ? ? ? ? while (true) {
? ? ? ? ? ? ? ? fuwu:
? ? ? ? ? ? ? ? cout << wmn.getID() << "號服務(wù)員為您服務(wù),本平臺為您提供了如下功能:1.查詢客房信息 ?2.辦理入住 ?3.提前預(yù)約 ?4.辦理退房 ?0.退出" << endl;
? ? ? ? ? ? ? ? cout << "請選擇需要的服務(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 << "輸入客戶入住時間:";
? ? ? ? ? ? ? ? ? ? cin >> begin.year >> begin.month >> begin.day;
? ? ? ? ? ? ? ? ? ? cout << "輸入客戶離開時間:";
? ? ? ? ? ? ? ? ? ? cin >> end.year >> end.month >> end.day;
? ? ? ? ? ? ? ? ? ? cout << "客房信息如下:" << endl;
? ? ? ? ? ? ? ? ? ? for (int i = 0; i < Baseroom.getRoomnumber(); i++) {
? ? ? ? ? ? ? ? ? ? ? ? wmn.checkInformation(Room[i + 1]);
? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? cout << "請輸入入住客房號:";
? ? ? ? ? ? ? ? ? ? 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 << "輸入客戶入住時間:";
? ? ? ? ? ? ? ? ? ? cin >> begin.year >> begin.month >> begin.day;
? ? ? ? ? ? ? ? ? ? cout << "輸入客戶離開時間:";
? ? ? ? ? ? ? ? ? ? cin >> end.year >> end.month >> end.day;
? ? ? ? ? ? ? ? ? ? cout << "客房信息如下:" << endl;
? ? ? ? ? ? ? ? ? ? for (int i = 0; i < Baseroom.getRoomnumber(); i++) {
? ? ? ? ? ? ? ? ? ? ? ? wmn.checkInformation(Room[i + 1]);
? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? cout << "請輸入預(yù)約客房號:";
? ? ? ? ? ? ? ? ? ? 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 << "請輸入退房房間號:";
? ? ? ? ? ? ? ? ? ? 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 << "歡迎留言評論您的體驗:" << endl;
? ? ? ? ? ? ? ? ? ? cin >> comments[index];
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? else if (selection == 0) {
? ? ? ? ? ? ? ? ? ? break;
? ? ? ? ? ? ? ? }
? ? ? ? ? ? }
? ? ? ? }
? ? ? ? else if (user == 3) {
? ? ? ? ? ? cout << "用戶你好,歡迎您來到本酒店" << endl;
? ? ? ? ? ? while (true) {
? ? ? ? ? ? ? ? cout << "請問您有本平臺的賬號嗎?沒有可以注冊一個哦!" << endl;
? ? ? ? ? ? ? ? cout << "1.我已經(jīng)有賬號了 ? ?2.注冊 ? ? 0.退出" << endl;
? ? ? ? ? ? ? ? int selection;
? ? ? ? ? ? ? ? cin >> selection;
? ? ? ? ? ? ? ? if (selection == 1) {
? ? ? ? ? ? ? ? ? ? int count, key, rightcount, index = -1;
? ? ? ? ? ? ? ? x:
? ? ? ? ? ? ? ? ? ? cout << "請輸入賬號:" << endl;
? ? ? ? ? ? ? ? ? ? cin >> count;
? ? ? ? ? ? ? ? ? ? for (int i = 0; i < baseCusomer.getnumber(); i++) {
? ? ? ? ? ? ? ? ? ? ? ? if (Customer[i].getcount() == count) {
? ? ? ? ? ? ? ? ? ? ? ? ? ? index = i;
? ? ? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? if (index == -1) {
? ? ? ? ? ? ? ? ? ? ? ? cout << "不存在此賬號" << endl;
? ? ? ? ? ? ? ? ? ? ? ? goto x;
? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? y:
? ? ? ? ? ? ? ? ? ? cout << "請輸入密碼:";
? ? ? ? ? ? ? ? ? ? cin >> key;
? ? ? ? ? ? ? ? ? ? for (int i = 0; i < baseCusomer.getnumber(); i++) {
? ? ? ? ? ? ? ? ? ? ? ? if (Customer[index].getkey() == key) {
? ? ? ? ? ? ? ? ? ? ? ? ? ? cout << "登錄成功!" << endl;
? ? ? ? ? ? ? ? ? ? ? ? ? ? goto fuwu;
? ? ? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? ? ? else {
? ? ? ? ? ? ? ? ? ? ? ? ? ? cout << "密碼錯誤!" << endl;
? ? ? ? ? ? ? ? ? ? ? ? ? ? goto y;
? ? ? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? }
? ? ? ? ? ? ? ? else if (selection == 2) {
? ? ? ? ? ? ? ? ? ? int count, key, virity;
? ? ? ? ? ? ? ? ? ? cout << "請輸入注冊賬號:";
? ? ? ? ? ? ? ? ? ? cin >> count;
? ? ? ? ? ? ? ? ? ? cout << endl;
? ? ? ? ? ? ? ? a:
? ? ? ? ? ? ? ? ? ? cout << "請設(shè)置密碼:";
? ? ? ? ? ? ? ? ? ? cin >> key;
? ? ? ? ? ? ? ? ? ? cout << "請確認密碼:";
? ? ? ? ? ? ? ? ? ? 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 << "無效的選擇,重新選擇!";
? ? ? ? }
? ? }

? ? return 0;
}

以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

  • 一文解密C++中的多態(tài)機制

    一文解密C++中的多態(tài)機制

    眾所周知C++語言的三大特性:封裝、多態(tài)、繼承,其中多態(tài)就是去完成某個行為,但是會根據(jù)不同的對象產(chǎn)生不同的狀態(tài),下面小編就來帶大家深入了解一下C++的多態(tài)機制吧
    2023-07-07
  • 推箱子游戲C語言實現(xiàn)代碼

    推箱子游戲C語言實現(xiàn)代碼

    這篇文章主要為大家詳細介紹了推箱子游戲C語言實現(xiàn)代碼,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2020-12-12
  • 淺析VSCode tasks.json中的各種替換變量的意思 ${workspaceFolder} ${file} ${fileBasename} ${fileDirname}等

    淺析VSCode tasks.json中的各種替換變量的意思 ${workspaceFolder} ${file} ${

    這篇文章主要介紹了關(guān)于VSCode tasks.json中的各種替換變量的意思 ${workspaceFolder} ${file} ${fileBasename} ${fileDirname}等,本文給大家介紹的非常詳細,對大家的學(xué)習(xí)或工作具有參考借鑒價值,需要的朋友可以參考下
    2020-03-03
  • C/C++數(shù)據(jù)對齊詳細解析

    C/C++數(shù)據(jù)對齊詳細解析

    通常我們在寫代碼的時候是不需要考慮對齊的影響的,都是依賴編譯器來為我們選擇適合的對齊策略,我們也可以通過傳遞給編譯器預(yù)編譯指令來指定數(shù)據(jù)對齊的方法
    2013-10-10
  • 基于MFC和OpenCV實現(xiàn)角點檢測

    基于MFC和OpenCV實現(xiàn)角點檢測

    這篇文章主要為大家詳細介紹了基于MFC和OpenCV實現(xiàn)角點檢測,文中示例代碼介紹的非常詳細,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2019-03-03
  • Qt中QMainWindow使用及技巧

    Qt中QMainWindow使用及技巧

    QMainWindow是Qt框架中提供的一個主窗口類,它具有菜單欄、工具欄、狀態(tài)欄等常見的GUI元素,本文就來介紹一下使用技巧,具有一定的參考價值,感興趣的可以了解一下
    2023-10-10
  • static_cast,dynamic_cast,reinterpret_cast和const_cast的區(qū)別詳解

    static_cast,dynamic_cast,reinterpret_cast和const_cast的區(qū)別詳解

    以下是對static_cast,dynamic_cast,reinterpret_cast和const_cast之間的區(qū)別進行了詳細的介紹,需要的朋友可以過來參考下
    2013-09-09
  • C++實現(xiàn)遺傳算法

    C++實現(xiàn)遺傳算法

    這篇文章主要介紹了C++實現(xiàn)遺傳算法,以實例形式較為詳細的分析了遺傳算法的C++實現(xiàn)技巧,具有一定參考借鑒價值,需要的朋友可以參考下
    2015-12-12
  • 利用反射獲得類的public static/const成員的值實例

    利用反射獲得類的public static/const成員的值實例

    下面小編就為大家?guī)硪黄梅瓷浍@得類的public static/const成員的值實例。小編覺得挺不錯的,現(xiàn)在就分享給大家,也給大家做個參考。一起跟隨小編過來看看吧
    2016-12-12
  • 海量數(shù)據(jù)處理系列之:用C++實現(xiàn)Bitmap算法

    海量數(shù)據(jù)處理系列之:用C++實現(xiàn)Bitmap算法

    本篇文章是對用C++實現(xiàn)Bitmap算法進行了詳細的分析介紹,需要的朋友參考下
    2013-05-05

最新評論