-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmovieMain.cpp
203 lines (156 loc) · 5.82 KB
/
movieMain.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
201
202
203
#include <iostream>
#include "circDLList.h"
#include "Movie.h"
using namespace std;
int movieMenu ();
int main(){
int input;
string g, t;
circDLList<string> list;
Movie movie;
do{
input = movieMenu();
switch(input){
case 1:
system("CLS");
cout << "\t\tAdd A Genre\n"
<< "--------------------------------------------------------\n";
cout << "Enter the genre:\n";
cin >> g;
list.addGenre(g); //Llama la funcion addGenre
cout << "The Genre has been Added" << endl; //Confirma que el genero fue anadido
cout << "Genre Added: " << g << endl; //Te muestra el genero que fue anadido
cout << "All genre of the List: "; //Te muestra una lista en orden alfabetico de todos los generos
list.printRevList();
cout << endl;
break;
case 2:
system("CLS");
cout << "\t\tAdd a Movie\n"
<< "--------------------------------------------------------\n";
cout << "This are the Genre: \n";
list.printRevList();
cout << endl;
cout << "Enter the Genre do you want to add a movie: \n";
cin >> g;
if (list.searchGenre(g) != nullptr) {
list.addMovie(g, movie.createMovie());
movie.printMovie(movie);
}
else
{
cout << "Genre doesn't exist. Movie not added." << endl;
}
cout << endl;
break;
case 3:
system("CLS");
cout << "\t\tModify Movie\n"
<< "--------------------------------------------------------\n";
cout << "This are the Genre: \n";
list.printRevList();
cout << endl;
cout << "Enter the Genre do you want to modify the movie: \n";
cin >> g;
if (list.searchGenre(g) != nullptr) {
cout << "Enter the Title of the Movie: \n";
cin >> t;
list.modifyMovieCDLL(g, t);
}
else
{
cout << "Genre doesn't exist. Movie was not modified." << endl;
}
cout << endl;
break;
case 4:
system("CLS");
cout << "\t\tListing All Genre\n"
<< "--------------------------------------------------------\n";
cout << "This are the Genre: \n";
list.printRevList();
cout << endl;
break;
case 5:
system("CLS");
cout << "\t\tDelete a Movie\n"
<< "--------------------------------------------------------\n";
list.printRevList();
cout << endl;
cout << "Enter the Genre: \n";
cin >> g;
if (list.searchGenre(g) != nullptr) {
cout << "Enter the Title of the Movie: \n";
cin >> t;
list.deleteMovieCDLL(g, t);
}
else
{
cout << "Genre doesn't exist. Movie not added." << endl;
}
cout << endl;
break;
case 6:
system("CLS");
cout << "\t\tListing All Movies for a Genre\n"
<< "--------------------------------------------------------\n";
list.printRevList();
cout << endl;
cout << "Enter the Genre: \n";
cin >> g;
list.printAllMovieCDLL(g);
cout << endl;
break;
case 7:
system("CLS");
cout << "\t\tSearching Movie\n"
<< "--------------------------------------------------------\n";
cout << "This are the Genre: \n";
list.printRevList();
cout << endl;
cout << "Enter the Genre: \n";
cin >> g;
if (list.searchGenre(g) != nullptr) {
cout << "Enter the Title of the Movie: \n";
cin >> t;
list.searchMovieCDLL(g, t);
}
else
{
cout << "Genre doesn't exist. Movie not added." << endl;
}
cout << endl;
break;
case 8:
system("CLS");
cout << "Closing Program" << endl;
}
}while(input != 8);
return 0;
}
int movieMenu(){
int input;
cout << " \t\tMovie DataBase Menu\n "
<< "-------------------------------------------------------------------------------------\n"
<< " Welcome to the Movie Database Menu. Please choose one of the function of this menu\n"
<< " Enter the number paired with the following function:\n"
<< " ------------------------------------------------------------------------------------\n"
<< " 1. Add a Genre\n"
<< " 2. Add a Movie\n"
<< " 3. Modify a Movie\n"
<< " 4. List of All Genre\n"
<< " 5. Delete a Movie\n"
<< " 6. List of AllMovies for a Selected Genre\n"
<< " 7. Search for a Movie\n"
<< " 8. EXIT\n"
<< "--------------------------------------------------------------------------------------\n"
<< " Choose: ";
cin >> input;
while (input <= 0 || input >= 9){
system("CLS");
cout << "ERROR. Please enter a number between 1 - 8: " << endl;
cout << endl;
movieMenu();
}
return input;
}