-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMovie.cpp
executable file
·55 lines (44 loc) · 1.03 KB
/
Movie.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
#include "Movie.h"
#include <algorithm>
using namespace std;
Movie::Movie (string t)
{
title = t;
} // constructor for a movie with the given title
Movie::Movie (const Movie & other)
{
title = other.title;
} // copy constructor
Movie::~Movie ()
{
} // destructor
string Movie::getTitle () const
{
return title;
} // returns the title of the movie
void Movie::addKeyword (string keyword)
{
keywords.add(keyword);
}
/* Adds the (free-form) keyword to this movie.
If the exact same keyword (up to capitalization) was already
associated with the movie, then the keyword is not added again. */
Set<string> Movie::getAllKeywords () const
{
return keywords;
}
/* Returns a set of all keywords associated with the movie. */
void Movie::printMovie ()
{
cout << title << endl;
keywords.printAll();
}
string Movie::returnKeywords() const
{
string keyword = "";
for ( Set<string>::Iterator si = this->keywords.begin(); si != this->keywords.end(); ++si )
{
keyword = keyword + *si + "\n";
}
return keyword;
}