-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
53 lines (48 loc) · 1.69 KB
/
main.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#include "BookingSystem.h"
#include <iostream>
#include <limits>
int main() {
BookingSystem system;
system.loadFromCSV("venues.csv");
int choice;
std::string venueName, date;
while (true) {
std::cout << "1. Add Venue\n2. Add Date to Venue\n3. Book Venue\n4. Show Venues\n5. Exit\n";
std::cin >> choice;
std::cin.ignore(std::numeric_limits<std::streamsize>::max(), '\n'); // Ignore leftover input
switch (choice) {
case 1:
std::cout << "Enter venue name: ";
std::getline(std::cin, venueName);
system.addVenue(venueName);
break;
case 2:
std::cout << "Enter venue name: ";
std::getline(std::cin, venueName);
std::cout << "Enter date (YYYY-MM-DD): ";
std::getline(std::cin, date);
system.addDateToVenue(venueName, date);
break;
case 3:
std::cout << "Enter venue name: ";
std::getline(std::cin, venueName);
std::cout << "Enter date (YYYY-MM-DD): ";
std::getline(std::cin, date);
if (system.bookVenue(venueName, date)) {
std::cout << "Booking successful!\n";
} else {
std::cout << "Booking failed. Date not available.\n";
}
break;
case 4:
system.printVenues();
break;
case 5:
system.saveToCSV("venues.csv");
return 0;
default:
std::cout << "Invalid choice. Try again.\n";
}
}
return 0;
}