Statische liste der Motorräder erstellt. #2

This commit is contained in:
Holger Boerchers 2018-12-25 13:38:17 +01:00
parent ec13686ef3
commit e57a04aae2

View File

@ -1,6 +1,7 @@
#include <iostream>
#include <string>
#include <list>
#include <experimental/filesystem>
using namespace std;
@ -82,7 +83,7 @@ class reservation final
private:
tm start_ = {};
tm end_ = {};
short motorcycle_ = -1; // => nothing reserved
short motorcycle_ = -1; // => -1 means nothing reserved
string customer_name_;
string costumer_first_name_;
public:
@ -137,6 +138,14 @@ public:
}
};
string motorcycles[] = {
"Suzuki Bandit",
"Honda TransAlp",
"BMW F 650 GS"
"Kawasaki ZZR1400"
};
int size_of_motorcycles = 4;
void create_customer();
void create_reservation();
@ -148,41 +157,50 @@ list<reservation> reservations;
int main()
{
while (true)
try
{
system("cls");
cout << "Motorradvermietung (" << reservations.size() << " Reservierungen; " << customers.size() << " Kunden)"
<< endl << endl;
cout << "Bitte w\x84hlen Sie eine Option:" << endl;
cout << "1: Neuen Kunden anlegen" << endl;
cout << "2: Erstellen einer Reservierung" << endl;
cout << "3: Motorrad herausgeben" << endl;
cout << "4: Reservierungen exportieren" << endl;
cout << endl;
cout << "0: Programm beenden" << endl;
const auto input = ask_question<int>("Ihre Eingabe");
switch (input)
while (true)
{
case 1:
create_customer();
break;
case 2:
create_reservation();
break;
case 3:
rent_a_motorcycle();
break;
case 4:
export_reservations();
break;
case 0:
return 0;
default:
cout << "Unerlaubte Eingabe" << endl;
system("pause");
system("cls");
cout << "Motorradvermietung (" << reservations.size() << " Reservierungen; " << customers.size() <<
" Kunden)"
<< endl << endl;
cout << "Bitte w\x84hlen Sie eine Option:" << endl;
cout << "1: Neuen Kunden anlegen" << endl;
cout << "2: Erstellen einer Reservierung" << endl;
cout << "3: Motorrad herausgeben" << endl;
cout << "4: Reservierungen exportieren" << endl;
cout << endl;
cout << "0: Programm beenden" << endl;
const auto input = ask_question<int>("Ihre Eingabe");
switch (input)
{
case 1:
create_customer();
break;
case 2:
create_reservation();
break;
case 3:
rent_a_motorcycle();
break;
case 4:
export_reservations();
break;
case 0:
return 0;
default:
cout << "Unerlaubte Eingabe" << endl;
system("pause");
}
}
}
catch (...)
{
cout << "Etwas unvorhergesehendes ist passiert. Tut mir leid." << endl;
system("pause");
}
}
void create_customer()