Statische liste der Motorräder erstellt. #2
This commit is contained in:
parent
ec13686ef3
commit
e57a04aae2
@ -1,6 +1,7 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <list>
|
#include <list>
|
||||||
|
#include <experimental/filesystem>
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
@ -82,7 +83,7 @@ class reservation final
|
|||||||
private:
|
private:
|
||||||
tm start_ = {};
|
tm start_ = {};
|
||||||
tm end_ = {};
|
tm end_ = {};
|
||||||
short motorcycle_ = -1; // => nothing reserved
|
short motorcycle_ = -1; // => -1 means nothing reserved
|
||||||
string customer_name_;
|
string customer_name_;
|
||||||
string costumer_first_name_;
|
string costumer_first_name_;
|
||||||
public:
|
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_customer();
|
||||||
void create_reservation();
|
void create_reservation();
|
||||||
@ -148,41 +157,50 @@ list<reservation> reservations;
|
|||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
while (true)
|
try
|
||||||
{
|
{
|
||||||
system("cls");
|
while (true)
|
||||||
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:
|
system("cls");
|
||||||
create_customer();
|
cout << "Motorradvermietung (" << reservations.size() << " Reservierungen; " << customers.size() <<
|
||||||
break;
|
" Kunden)"
|
||||||
case 2:
|
<< endl << endl;
|
||||||
create_reservation();
|
cout << "Bitte w\x84hlen Sie eine Option:" << endl;
|
||||||
break;
|
cout << "1: Neuen Kunden anlegen" << endl;
|
||||||
case 3:
|
cout << "2: Erstellen einer Reservierung" << endl;
|
||||||
rent_a_motorcycle();
|
cout << "3: Motorrad herausgeben" << endl;
|
||||||
break;
|
cout << "4: Reservierungen exportieren" << endl;
|
||||||
case 4:
|
cout << endl;
|
||||||
export_reservations();
|
cout << "0: Programm beenden" << endl;
|
||||||
break;
|
const auto input = ask_question<int>("Ihre Eingabe");
|
||||||
case 0:
|
|
||||||
return 0;
|
switch (input)
|
||||||
default:
|
{
|
||||||
cout << "Unerlaubte Eingabe" << endl;
|
case 1:
|
||||||
system("pause");
|
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()
|
void create_customer()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user