Label for admin exit, main interface looped
This commit is contained in:
parent
1aa6a67ebc
commit
5e33eaeede
@ -27,6 +27,7 @@ void interface(vector<Park_spot>& spots) {
|
||||
}
|
||||
|
||||
void interface_member(vector<Park_spot>& spots) {
|
||||
__label__ exit;
|
||||
int id;
|
||||
string password;
|
||||
cout << "\nPlease input id:";
|
||||
@ -36,8 +37,9 @@ void interface_member(vector<Park_spot>& spots) {
|
||||
cout << "\nPlease input password:";
|
||||
std::getline(cin, password);
|
||||
while (!(verify_password(c.password, password))) {
|
||||
cout << "ERROR: wrong password. Please retype your password:\n";
|
||||
cout << "ERROR: wrong password. Please retype your password or enter [exit] to exit :\n";
|
||||
std::getline(cin, password);
|
||||
if (password=="exit") goto exit;
|
||||
}
|
||||
|
||||
cout << "Logged in succesfully\n";
|
||||
@ -58,9 +60,12 @@ void interface_member(vector<Park_spot>& spots) {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
exit: ;
|
||||
}
|
||||
|
||||
void interface_admin(vector<Park_spot>& spots) {
|
||||
__label__ exit, begin;
|
||||
begin: ;
|
||||
cout << "Welcome to the admin interface. It is not completely ready yet.\n";
|
||||
cout << "[1] See monthly report of ALL parking spots\n";
|
||||
cout << "[2] See weekly report of ALL parking spots\n";
|
||||
@ -69,6 +74,7 @@ void interface_admin(vector<Park_spot>& spots) {
|
||||
cout << "[5] See current status of parking spots\n";
|
||||
cout << "[6] Make new customer\n";
|
||||
cout << "[7] Make new parking spot\n";
|
||||
cout << "[8] Exit\n";
|
||||
cout << "option[1-7]:";
|
||||
int option;
|
||||
cin >> option;
|
||||
@ -111,9 +117,16 @@ void interface_admin(vector<Park_spot>& spots) {
|
||||
break;
|
||||
}
|
||||
|
||||
case 8: {
|
||||
goto exit;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
goto begin;
|
||||
exit: ;
|
||||
}
|
||||
|
||||
// --------- individual things.
|
||||
@ -175,11 +188,11 @@ void new_customer() {
|
||||
}
|
||||
|
||||
void new_parkspot(vector<Park_spot>& spots) {
|
||||
cout << "What type of parking spot? [1] twoweeler, [2] fourweeler: ";
|
||||
cout << "What type of parking spot? [1] Twowheeler, [2] Fourwheeler: ";
|
||||
int vtype;
|
||||
cin >> vtype;
|
||||
cin.ignore(10000, '\n');
|
||||
Park_spot newspot{Vehicle_type(vtype)};
|
||||
spots.push_back(newspot);
|
||||
cout << "new parking spot sucessfully created.\n";
|
||||
cout << "New parking spot sucessfully created.\n";
|
||||
}
|
@ -154,7 +154,7 @@ void current_status_parkspots(vector<Park_spot>& spots) {
|
||||
}
|
||||
}
|
||||
|
||||
// -------------- paroking spots
|
||||
// -------------- parking spots
|
||||
|
||||
// vector<Park_spot> populate_spots(){
|
||||
// vector<Park_spot> spots;
|
||||
|
Loading…
Reference in New Issue
Block a user