-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
53 lines (48 loc) · 1.38 KB
/
main.cpp
File metadata and controls
53 lines (48 loc) · 1.38 KB
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 <iostream>
#include "colors.hpp"
#include "TransitSystem.cpp"
using namespace std;
int main()
{
enableANSI();
TransitSystem metro;
metro.loadHistory();
int ch;
while (true)
{
cout << "\n╔══════════════════════════════════╗\n";
cout << "║ " << BLUE << BOLD << " SMART METRO TRANSIT SYSTEM" << RESET << " ║\n";
cout << "╚══════════════════════════════════╝\n";
cout << "\n1.Create Pass\n2.View Passes\n3.Start Journey\n4.View History\n5.Recharge\n0.Exit\n> ";
cin >> ch;
if (cin.fail())
{
cin.clear();
cin.ignore(10000, '\n');
cout << RED << "Invalid input! Please enter a number." << RESET << endl;
continue;
}
switch (ch)
{
case 1:
metro.createPass();
break;
case 2:
metro.showAllPasses();
break;
case 3:
metro.startJourney();
break;
case 4:
metro.showHistory();
break;
case 5:
metro.rechargePass();
break;
case 0:
return 0;
default:
cout << RED << "Invalid choice!" << RESET << endl;
}
}
}