DVD Collection Program

Hello everyone. I'm working on a program that maintains a collection of DVDs. I will post the specifications below, and then the code and errors on the following post because of the size. Keep in mind that there are two functions that I have not made yet, as I would like to get my current errors sorted out before I beat my head against the wall figuring out the rest. I appreciate any help and thank you ahead of time. ~Sarah

Specs:
This program will allow the user to keep track of a CD or DVD collection. This can only work exclusively with either CDs or DVDs since some of the data is different—your choice. Each CD/DVD in the collection will be represented as a class, so you will have one class that is a single CD/DVD.

The CD class will use a vector to keep track of the titles of the songs on the CD; this will allow each CD to have a different number of songs. It should also maintain the length of each song thus another vector. The class will also keep track of the total length of the CD. The class will also have a data member for the artist name and the name of the CD.

The DVD class will have data members for the title of the movie, the length of the movie, and the year the movie was released. The class will have a vector which is used to store the name of the actors and actresses in the movie. Another vector will be used to maintain the character names that the actor/actress played in the movie. These two vectors must work in parallel, meaning the first actor/actress in the list must correspond to the first character in the other vector.

The program will maintain a list of CD/DVDs. This list will be a vector of that class type (CD or DVD). The program must provide methods (functions) to add a CD/DVD, remove a CD/DVD and update a CD/DVD. There should also be a function that displays the entire list of CDs/DVDs. The output must be a table format, with heading.

For the DVDs:

Movie Title
Length of Movie
Year Released
Actors/Actresses
Characters
Note: the movie title, length of movie and year released should only appear once while the actors/actresses and characters will have several lines. So the other columns must be displayed with blanks.

I am doing the DVD one.

Here is my code so far (don't judge. I'm a newbie.):

DVDcollection.h:

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
#include <iostream>
#include <string>
#include <vector>

using namespace std;


class DVD    
{

private:
	string title;             //To hold title of movie
	int year;                 //To hold year release
	double length;            //To hold length of movie


public:
	vector<string> actor;     //To hold actor and actress names
	vector<string> charNames; //To hold name of character


	//Default constructor setting everything to zero
	DVD()
	{
		title = " ";
		length = 0;
		year = 0;
	}

	DVD(string t, double l, int y) 
	{
		title = t;
		length = l;
		year = y;
	}

	// Mutator Functions
	void setTitle(string t)
	{
		title;
	}


	void setLength(double l)
	{
		length;
	}

	void setYear(int y)
	{
		year;
	}

	string getTitle() const
	{
		return title;
	}

	double getLength() const
	{
		return length;
	}

	int getYear() const
	{
		return year;
	}

	void DVD::addActor(string actors, string charNames)
	{

		actor.push_back(actors);       

		characterName.push_back(charNames);  

	}
};


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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217

#include "DVDcollection.h"
#include <iostream>
#include <string>
#include <vector>
#include <iomanip>
using namespace std;


int main()

{
	int choice;				// To hold choice for the menu
	int howMany;			// To hold the number of actors to be entered
	string title;			// To hold the title of the DVD
	int year;				// To hold the year released
	double length;			// To hold the length of the movie
	string actor;			// To hold the name of the actor
	string characterName;   // To hold the character name

	class DVD DVD;			// DVD class


	// Function Prototypes
	void showList(string, double, int, string, string);
	void removeDVD(string);
	void updateDVD(string);

	//Menu System
	cout << "-----------------------------------------------------------------------------------------" << endl;
	cout << "                                      DVD Collection                                     " << endl;
	cout << "-----------------------------------------------------------------------------------------" << endl;
	cout << endl << endl;

	cout << "1. Add a DVD" << endl;
	cout << "2. Remove a DVD" << endl;
	cout << "3. Update a DVD" << endl;
	cout << "4. Show List of DVDs" << endl;
	cout << "5. Exit" << endl;
	cin >> choice;


	switch (choice)
	{

	case 1:
	{
		cout << "To add a new DVD - enter the title, length, year released, actors/actresses and their characters:" << endl;
		cout << endl;

		cout << "Movie Title: ";
		getline(cin, title);
		cout << endl;

		cout << "Length: ";
		cin >> length;
		cout << endl;

		cout << "Year: ";
		cin >> year;
		cout << endl;

		cout << "You entered: " << title << " " << length << " " << year << endl;

		cout << endl;

		cout << "How many actors/characters do you want to add?" << endl;
		cin >> howMany;



		// Loop to allow entry of all actors desired

		for (int count = 0; count < howMany; count++)
		{
			//Actor and Actress
			cout << "Actor/Actress #" << (count + 1) << " Name: ";
			getline(cin, actor);
			cout << endl;

			//Character they play
			cout << "Character they play: ";
			getline(cin, characterName);
		}


		//Store the dvd info

		DVD.setTitle(title);
		DVD.setYear(year);
		DVD.setLength(length);
		DVD.addActor(actor, characterName);

	}break;





	case 2:
	{
		void removeDVD();
		break;
	}
	
	case 3:
	{
		void updateDVD();
		break;
	}

	case 4:
	{
		void showList();
		break;
	}

	case 5:
	{
		exit(0);
	}

	}

}


// ***
// Definition of function showList
// This function displays the list of DVDs that have been stored
// ***

void showList(vector<DVD> &vectorActor, vector<string>&vectorCharNames, DVD *DVD)
{

	// Formats the table for the output
	cout << setw(10) << "\nMovie Title: "
		<< setw(10) << "Length:"
		<< setw(10) << "Year: "
		<< setw(10) << "Actors/Actresses:"
		<< setw(10) << "Characters:\n" << endl;

	cout << "------------------------------------------------------------\n";
	for (int count = 0; count < vectorActor.size(); count++)
	{
		if (count < 1)
		{
			if (DVD[count].getLength() != 0)
			{
				cout << endl << setw(10) << right << DVD[count].getTitle()
					<< setw(10) << DVD[count].getLength()
					<< setw(10) << DVD[count].getYear();
			}
			else
			{
				cout << setw(10) << right << DVD[count].getTitle();
			}
		}
		else
		{
			if (DVD[count].getLength() != 0)
			{

				cout << endl << setw(10) << right << DVD[count].getTitle()
					<< setw(10) << DVD[count].getLength()
					<< setw(10) << DVD[count].getYear();
			}
			else
			{
				cout << setw(10) << right << DVD[count].getTitle();
			}
		}


		if (count < 1)
			cout << "\t\t" << vectorActor[count].addActor()
			<< " " << vectorCharNames[count] << endl;
		else
		{
			cout << "\t\t\t\t" << vectorActor[count].addActor()
				<< " " << vectorCharNames[count] << endl;
		}
	}
}


// ***
// Definition of function removeDVD
// This function removes one of the DVDs that have been stored
// ***

void RemoveDVD(string, class DVD &DVD)
{
    cout << "\nEnter the Movie Title you would like to remove: ";
    string title = "";
    cin.sync();
    getline(cin, title);
    map<string,DVD>::iterator result = collection.find(title);

    if (result == collection.end())
    {
        cout << "\nNo records found. None were removed.";
        return;
    }

    cout << "\nThis dvd was found:";
    (*result).second.listDVDData(cout);

    char confirm;
    cout << "\nConfirm removal(y/n): ";
    cin >> confirm;

    if (tolower(confirm) == 'y')
    {
        collection.erase(result);
    }
};


Here are the errors I am currently getting. I had quite a few more before I posted this, but was able to get rid of some of them on my own just by looking at the line numbers.

Errors:
1>------ Build started: Project: Week8ClassProject, Configuration: Debug Win32 ------
1> main.cpp
1>c:\users\x\documents\visual studio 2015\projects\week8classproject\week8classproject\dvdcollection.h(74): error C2065: 'characterName': undeclared identifier
1>c:\users\x\documents\visual studio 2015\projects\week8classproject\week8classproject\dvdcollection.h(74): error C2228: left of '.push_back' must have class/struct/union
1> c:\users\x\documents\visual studio 2015\projects\week8classproject\week8classproject\dvdcollection.h(74): note: type is 'unknown-type'
1>c:\users\x\documents\visual studio 2015\projects\week8classproject\week8classproject\main.cpp(144): warning C4018: '<': signed/unsigned mismatch
1>c:\users\x\documents\visual studio 2015\projects\week8classproject\week8classproject\main.cpp(176): error C2660: 'DVD::addActor': function does not take 0 arguments
1>c:\users\x\documents\visual studio 2015\projects\week8classproject\week8classproject\main.cpp(180): error C2660: 'DVD::addActor': function does not take 0 arguments
1>c:\users\x\documents\visual studio 2015\projects\week8classproject\week8classproject\main.cpp(198): error C2065: 'map': undeclared identifier
1>c:\users\x\documents\visual studio 2015\projects\week8classproject\week8classproject\main.cpp(198): error C2275: 'std::string': illegal use of this type as an expression
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\xstring(2634): note: see declaration of 'std::string'
1>c:\users\x\documents\visual studio 2015\projects\week8classproject\week8classproject\main.cpp(198): error C2955: 'std::iterator': use of class template requires template argument list
1> c:\program files (x86)\microsoft visual studio 14.0\vc\include\xutility(564): note: see declaration of 'std::iterator'
1>c:\users\x\documents\visual studio 2015\projects\week8classproject\week8classproject\main.cpp(198): error C2146: syntax error: missing ';' before identifier 'result'
1>c:\users\x\documents\visual studio 2015\projects\week8classproject\week8classproject\main.cpp(198): error C2065: 'result': undeclared identifier
1>c:\users\x\documents\visual studio 2015\projects\week8classproject\week8classproject\main.cpp(198): error C2065: 'collection': undeclared identifier
1>c:\users\x\documents\visual studio 2015\projects\week8classproject\week8classproject\main.cpp(198): error C2228: left of '.find' must have class/struct/union
1> c:\users\x\documents\visual studio 2015\projects\week8classproject\week8classproject\main.cpp(198): note: type is 'unknown-type'
1>c:\users\x\documents\visual studio 2015\projects\week8classproject\week8classproject\main.cpp(200): error C2065: 'result': undeclared identifier
1>c:\users\x\documents\visual studio 2015\projects\week8classproject\week8classproject\main.cpp(200): error C2065: 'collection': undeclared identifier
1>c:\users\x\documents\visual studio 2015\projects\week8classproject\week8classproject\main.cpp(200): error C2228: left of '.end' must have class/struct/union
1> c:\users\x\documents\visual studio 2015\projects\week8classproject\week8classproject\main.cpp(200): note: type is 'unknown-type'
1>c:\users\x\documents\visual studio 2015\projects\week8classproject\week8classproject\main.cpp(207): error C2065: 'result': undeclared identifier
1>c:\users\x\documents\visual studio 2015\projects\week8classproject\week8classproject\main.cpp(207): error C2228: left of '.second' must have class/struct/union
1> c:\users\x\documents\visual studio 2015\projects\week8classproject\week8classproject\main.cpp(207): note: type is 'unknown-type'
1>c:\users\x\documents\visual studio 2015\projects\week8classproject\week8classproject\main.cpp(207): error C2228: left of '.listDVDData' must have class/struct/union
1>c:\users\x\documents\visual studio 2015\projects\week8classproject\week8classproject\main.cpp(215): error C2065: 'collection': undeclared identifier
1>c:\users\x\documents\visual studio 2015\projects\week8classproject\week8classproject\main.cpp(215): error C2228: left of '.erase' must have class/struct/union
1> c:\users\x\documents\visual studio 2015\projects\week8classproject\week8classproject\main.cpp(215): note: type is 'unknown-type'
1>c:\users\x\documents\visual studio 2015\projects\week8classproject\week8classproject\main.cpp(215): error C2065: 'result': undeclared identifier
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
header file
- line 69: don't need scope resolution DVD:: for member method inside class
- line 74: string charNames conflicts with vector charNames declared on line 19

main()
- line 120: needs #include <cstdlib>, may work on some compilers w/o the header file but that would be implementation dependant
- lines 176, 180: addActor() function signature does not match addActor() declaration and defintion in header file, line 69
- line 198: to use std::map you need to (a) #include <map>, (b) declare the map<string, DVD> collection and, only then (c) declare the iterator result

These should clean up some of your errors, probably not all. See how the program looks after these fixes. Also, re-consider your naming convention:
main - line 21: DVD DVD, then the vector<string>charNames, string charNames mentioned above is v confusing
dvdcollection.h
Line 69: When defining a member function in a class declaration, don't include the DVD::

Line 69: Don't name you arguments (charNames) the same as you member variable
names. This will hide the member variable.

Line 74: Your vector name is wrong.
69
70
71
72
void addActor(string actors, string charname)
	{   actor.push_back(actors);       
		charNames.push_back(charname);  
	}


main.cpp
Line 21: You don't need the keyword class here.

Line 21, 133, 192: Don't name your class and your instance the same (DVD). The compiler knows the difference (usually), but it's confusing to the reader.

Line 132: Shouldn't the first argument type be vector<string> ?

Line 143: count should be type size_t to match the type of size(), or use auto

Line 197: You haven't included the <map> header.

Line 197,200,215: collection is undefined.

Line 207: This line makes no sense.


Lines 175,179: addActor is a void function. You can;t use it in a cout statement.
That helped tremendously! Thank you both. Now I just gotta figure out a few more things that are giving errors.

DVDcollection.h:

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
#include <iostream>
#include <string>
#include <vector>

using namespace std;


class DVD    
{

private:
	string title;             //To hold title of movie
	int year;                 //To hold year release
	double length;            //To hold length of movie


public:
	vector<string> actor;     //To hold actor and actress names
	vector<string> charNames; //To hold name of character


	//Default constructor setting everything to zero
	DVD()
	{
		title = " ";
		length = 0;
		year = 0;
	}

	DVD(string t, double l, int y) 
	{
		title = t;
		length = l;
		year = y;
	}

	// Mutator Functions
	void setTitle(string t)
	{
		title;
	}


	void setLength(double l)
	{
		length;
	}

	void setYear(int y)
	{
		year;
	}

	string getTitle() const
	{
		return title;
	}

	double getLength() const
	{
		return length;
	}

	int getYear() const
	{
		return year;
	}

	void addActor(string actors, string charName)
	{

		actor.push_back(actors);       

		charNames.push_back(charName);  

	}
};


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
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
#include "DVDcollection.h"
#include <iostream>
#include <string>
#include <vector>
#include <iomanip>
#include <map>
using namespace std;


int main()

{
	int choice;				// To hold choice for the menu
	int howMany;			// To hold the number of actors to be entered
	string title;			// To hold the title of the DVD
	int year;				// To hold the year released
	double length;			// To hold the length of the movie
	string actor;			// To hold the name of the actor
	string characterName;   // To hold the character name

	DVD myDVD;				// DVD class


	// Function Prototypes
	void showList(string, double, int, string, string);
	void removeDVD(string);
	void updateDVD(string);

	//Menu System
	cout << "-----------------------------------------------------------------------------------------" << endl;
	cout << "                                      DVD Collection                                     " << endl;
	cout << "-----------------------------------------------------------------------------------------" << endl;
	cout << endl << endl;

	cout << "1. Add a DVD" << endl;
	cout << "2. Remove a DVD" << endl;
	cout << "3. Update a DVD" << endl;
	cout << "4. Show List of DVDs" << endl;
	cout << "5. Exit" << endl;
	cin >> choice;


	switch (choice)
	{

	case 1:
	{
		cout << "To add a new DVD - enter the title, length, year released, actors/actresses and their characters:" << endl;
		cout << endl;

		cout << "Movie Title: ";
		getline(cin, title);
		cout << endl;

		cout << "Length: ";
		cin >> length;
		cout << endl;

		cout << "Year: ";
		cin >> year;
		cout << endl;

		cout << "You entered: " << title << " " << length << " " << year << endl;

		cout << endl;

		cout << "How many actors/characters do you want to add?" << endl;
		cin >> howMany;



		// Loop to allow entry of all actors desired

		for (int count = 0; count < howMany; count++)
		{
			//Actor and Actress
			cout << "Actor/Actress #" << (count + 1) << " Name: ";
			getline(cin, actor);
			cout << endl;

			//Character they play
			cout << "Character they play: ";
			getline(cin, characterName);
		}


		//Store the dvd info

		myDVD.setTitle(title);
		myDVD.setYear(year);
		myDVD.setLength(length);
		myDVD.addActor(actor, characterName);

	}break;





	case 2:
	{
		void removeDVD();
		break;
	}
	
	case 3:
	{
		void updateDVD();
		break;
	}

	case 4:
	{
		void showList();
		break;
	}

	case 5:
	{
		exit(0);
	}

	}

}


// ***
// Definition of function showList
// This function displays the list of DVDs that have been stored
// ***

void showList(vector<string> &vectorActor, vector<string>&vectorCharNames, DVD *myDVD)
{

	// Formats the table for the output
	cout << setw(10) << "\nMovie Title: "
		<< setw(10) << "Length:"
		<< setw(10) << "Year: "
		<< setw(10) << "Actors/Actresses:"
		<< setw(10) << "Characters:\n" << endl;

	cout << "------------------------------------------------------------\n";
	for (auto count = 0; count < vectorActor.size(); count++)
	{
		if (count < 1)
		{
			if (myDVD[count].getLength() != 0)
			{
				cout << endl << setw(10) << right << myDVD[count].getTitle()
					<< setw(10) << myDVD[count].getLength()
					<< setw(10) << myDVD[count].getYear();
			}
			else
			{
				cout << setw(10) << right << myDVD[count].getTitle();
			}
		}
		else
		{
			if (myDVD[count].getLength() != 0)
			{

				cout << endl << setw(10) << right << myDVD[count].getTitle()
					<< setw(10) << myDVD[count].getLength()
					<< setw(10) << myDVD[count].getYear();
			}
			else
			{
				cout << setw(10) << right << myDVD[count].getTitle();
			}
		}


		if (count < 1)
			cout << "\t\t" << vectorActor[count]
			<< " " << vectorCharNames[count] << endl;
		else
		{
			cout << "\t\t\t\t" << vectorActor[count]
				<< " " << vectorCharNames[count] << endl;
		}
	}
}


// ***
// Definition of function removeDVD
// This function removes one of the DVDs that have been stored
// ***

void RemoveDVD(string, class DVD &myDVD)
{
    cout << "\nEnter the Movie Title you would like to remove: ";
    string title = "";
    cin.sync();
    getline(cin, title);
    map<string,DVD>::iterator result = myDVD.find(title);

    if (result == myDVD.end())
    {
        cout << "\nNo records found. None were removed.";
        return;
    }

    cout << "\nThis dvd was found:";
    (*result).second.listDVDData(cout);

    char confirm;
    cout << "\nConfirm removal(y/n): ";
    cin >> confirm;

    if (tolower(confirm) == 'y')
    {
        myDVD.erase(result);
    }
};


Errors:
1>------ Build started: Project: Week8ClassProject, Configuration: Debug Win32 ------
1> main.cpp
1>c:\users\x\documents\visual studio 2015\projects\week8classproject\week8classproject\main.cpp(145): warning C4018: '<': signed/unsigned mismatch
1>c:\users\x\documents\visual studio 2015\projects\week8classproject\week8classproject\main.cpp(199): error C2039: 'find': is not a member of 'DVD'
1> c:\users\x\documents\visual studio 2015\projects\week8classproject\week8classproject\dvdcollection.h(9): note: see declaration of 'DVD'
1>c:\users\x\documents\visual studio 2015\projects\week8classproject\week8classproject\main.cpp(201): error C2039: 'end': is not a member of 'DVD'
1> c:\users\x\documents\visual studio 2015\projects\week8classproject\week8classproject\dvdcollection.h(9): note: see declaration of 'DVD'
1>c:\users\x\documents\visual studio 2015\projects\week8classproject\week8classproject\main.cpp(208): error C2039: 'listDVDData': is not a member of 'DVD'
1> c:\users\x\documents\visual studio 2015\projects\week8classproject\week8classproject\dvdcollection.h(9): note: see declaration of 'DVD'
1>c:\users\x\documents\visual studio 2015\projects\week8classproject\week8classproject\main.cpp(216): error C2039: 'erase': is not a member of 'DVD'
1> c:\users\x\documents\visual studio 2015\projects\week8classproject\week8classproject\dvdcollection.h(9): note: see declaration of 'DVD'
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
You have a more fundamental problem in switch case 1 - adding a DVD - all the local variables are added into the DVD myDVD object but then this myDVD object is not saved in a container like map or vector, so next time you come to add a DVD all the previous info is overwritten

Same with your variables strings and characterName - they are being overwritten for each new actor/actress without being saved anywhere, you need to move myDVD.addActor(actor, characterName); to inside the for() loop

And you still haven't declared the map
main.cpp
Line 21: I think you want something like this instead of myDVD.
Add as global at line 9:
 
    map<string,DVD>     collection;


Line 87-92: If you get rid of myDVD as a global (as you should), you need to define it here as a local:
1
2
3
4
5
6
  DVD myDVD;
  myDVD.setTitle(title);
  myDVD.setYear(year);
  myDVD.setLength(length);
  myDVD.addActor(actor, characterName);
  collection.insert (title, myDVD);


Line 102,108,114: Remove the void The void makes these function prototypes, not function calls.

Line 102,108: removeDVD, updateDVD take a string as an argument.

Line 114: showList() requires 4 arguments.

Line 198: myDVD is a single DVD. DVD has no find function. Assuming you replace line 21 as above, then this becomes:
 
map<string,DVD>::iterator result = collection.find(title);


Line 200: DVD has no member function end(). Use collection.

Line 206: DVD has no member function listDVDdata().

Line 215: DVD has no member function erase. Use collection.


Awesome, I think I'm starting to get where I went wrong. Thank you both for your help. There's only one thing I don't understand, and maybe you can explain the error to me. When I changed my lines 92-97:
1
2
3
4
5
		myDVD.setTitle(title);
		myDVD.setYear(year);
		myDVD.setLength(length);
		myDVD.addActor(actor, characterName);
		collection.insert(title, myDVD);


It gives error:
main.cpp(97): note: No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called

The '.' between collection and insert is highlighted red. How do I fix this one?
try:
collection.insert(make_pair(title, myDVD));
Last edited on
Topic archived. No new replies allowed.