forked from KarthikeyanKS00747/Conference_Management
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathConference_Management_Main.cpp
200 lines (178 loc) · 4.86 KB
/
Conference_Management_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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
#include <iostream>
#include <string>
#include "User.hpp"
#include "Conference.hpp"
#include <limits>
//#include "DateTime.hpp"
//#include "Venue.h"
//#include "Sponsor.h"
#include "Participant.hpp"
// #include "Organiser.h"
#include <map>
std::map<std::string, Conference*> Conference::conferenceMap;
int Conference::no_of_conferences = 0;
std :: map<std::string, User*> userMap;
static int numVenues = 0;
void page_1();
void exploreConferences(User &user)
{
int i = 1;
for (const auto& pair : Conference :: conferenceMap)
{
std::cout << i << ". " << pair.first << "\n";
i++;
}
std::cout << "Enter the number of the conference you want to explore: ";
int choice;
std::cin >> choice;
// Get the selected conference
auto it = Conference :: conferenceMap.begin();
std::advance(it, choice - 1);
Conference* selectedConference = it -> second;
std::cout << "You selected: " << selectedConference->getName() << "\n";
std::cout << "1. Join\n";
std::cout << "2. Organise\n";
std::cout << "3. Sponsor\n";
std::cout << "4. Back to main menu\n";
std::cout << "Enter your choice: ";
std::cin >> choice;
switch(choice) {
case 1:
{
Participant p(user);
p.showTime();
char choice;
do
{
std :: string name, day, time;
std :: cout << "\nEnter the name of the conference: ";
getline(std :: cin, name);
std :: cout << "Enter the date for scheduling the conference (e.g., 2024-03-21): ";
getline(std :: cin, day);
std :: cout << "Enter the time for scheduling the conference (e.g., 10:00 AM): ";
getline(std :: cin, time);
p.scheduleConference(name, day, time);
std :: cout << "\nDo you want to schedule another conference? (y/n): ";
std :: cin >> choice;
std :: cin.ignore(std :: numeric_limits<std :: streamsize> :: max(), '\n'); // Clear input buffer
}
while (choice == 'y' || choice == 'Y');
break;
}
case 2:
// Code to organise the conference
break;
case 3:
// Code to sponsor the conference
break;
case 4:
// Code to go back to the main menu
break;
default:
std::cout << "Invalid choice. Please try again.\n";
}
}
void createConferences(){};
void page_2(User &user)
{
std :: cout << "\t\tMAIN MENU";
std :: cout << "1. Explore Conferences\n";
std :: cout << "2. Create Conference\n";
std :: cout << "3. Exit\n";
int resp;
std :: cin >> resp;
do
{
switch(resp)
{
case 1:
exploreConferences(user);
break;
case 2:
createConferences();
break;
case 3:
exit(0);
default:
std :: cout << "Invalid response\n";
}
}
while (true);
}
void sign_up()
{
std::string name;
short int age;
std::string regNO;
std::string gender;
std::string username;
std::string password;
std::string email;
std::cout << "Enter your details:\n";
std::cout << "Name: ";
std::cin >> name;
std::cout << "Age: ";
std::cin >> age;
std::cout << "Registration Number: ";
std::cin >> regNO;
std::cout << "Gender: ";
std::cin >> gender;
std::cout << "Username: ";
std::cin >> username;
std::cout << "Password: ";
std::cin >> password;
std::cout << "Email: ";
std::cin >> email;
// Create a new User and add it to the userMap
new User(name, age, regNO, gender, username, password, email);
std::cout << "Signed up successfully.\n";
page_1();
}
void sign_in()
{
std :: string username;
std :: string password;
std :: cout << "Username : ";
std :: cin >> username;
std :: cin >> password;
User *user = User :: getUserByUsername(username);
if (user != nullptr && user -> getPassword() == password)
{
std :: cout << "Password is correct.\n";
std :: cout << "Signed in successfully.";
}
else
{
std::cout << "Invalid username or password.\n";
}
page_2(*user);
}
void page_1()
{
std :: cout << "\t\tMAIN MENU";
std :: cout << "1. Sign-In\n";
std :: cout << "2. Sign-Up\n";
std :: cout << "3. Exit\n";
int resp;
std :: cin >> resp;
do
switch(resp)
{
case 1:
sign_in();
break;
case 2:
sign_up();
break;
case 3:
exit(0);
default:
std :: cout << "Invalid response\n";
}
while (true);
}
int main(void)
{
page_1();
return 0;
}