Label for admin exit, main interface looped

This commit is contained in:
unknown 2019-07-16 18:26:49 -03:00
parent 1aa6a67ebc
commit 5e33eaeede
3 changed files with 18 additions and 6 deletions

View File

@ -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";
}

View File

@ -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;

View File

@ -47,8 +47,7 @@ int main() {
// state of db:
// er zijn 10 parkspots, 5 met biketype en 5 met pickup type
// er is een customer met id 1(testcustomer) met password "password"
interface(parking_spots);
do { interface(parking_spots);} while (true);
}
/*