Class and vecors, writing CD collection program

I'm writing a code that keeps track of a CD collection, however I've run into some issues with my coding. I am getting errors that "left of the ' ' must have a class/struct/union. But I've declared my class? Any help appreciated

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
#include "CD.h" 
#include <vector>
#include <iostream>
#include <string>
#include <iomanip>
using namespace std; 

//Fuction Prototypes
void addCD(vector<string> &collection);
void displayCollection(vector<string> &collection); 
int getTotalSeconds(vector<int> lengths);
string convertSeconds(int totalSeconds);
void deleteCD(vector<string> &collection);
void editCD(vector<string> &collection);
void songEdit(vector<string> &collection, int editChoice);
void displaySongs(vector<string> &collection, int editChoice);

void main() 
{ 
	
	vector<string> collection; 
	
	CD collection;
	int choice;  
	 bool flag = false; 
	while (flag == false) 
	{ 
		cout << "1. Display CD collection\n" 
			 << "2. Add a CD to collection\n" 
			 << "3. Delete a CD\n" 
			 << "4. Edit a CD\n" 
			 << "5. Quit\n"; 
		cin >> choice; 

		while (choice < 1 || choice > 5) 
		{ 
			cout << "Invalid menu entry. Valid options are 1-5.\n"; 
			cin >> choice; 
		} 

	if (choice == 1)
	{ 
		displayCollection(collection); 
	}
	else if (choice == 2)  
	{ 
		addCD(collection); 
	} 
	else if (choice == 3)  
	{ 
		deleteCD(collection); 
	} 
	else if (choice == 4)  
	{ 
		editCD(collection); 
	} 
	else if (choice == 5) 
	{ 
		flag = true; } 
	} 
} 

void addCD(vector<string> &collection) 
{ 
	int size = collection.size();
	string userInput;
	string userIntInput;
	int numberOfSongs; 

	collection.resize(size + 1); 
	
	cout << "Who is the artist?\n";
	cin.ignore(200, '\n');  
	getline(cin, userInput); 
	collection[size].setArtist(userInput);  // Build error C2228
	
	cout << "What is the name of the CD?\n";  
	getline(cin, userInput); 
	collection[size].setCDName(userInput); 

	cout << "How many songs are on the CD?\n";
	cin >> numberOfSongs; 

	for (int count = 0; count < numberOfSongs; count++)  
	{ 
		cout << "Enter the song title for track " << (count + 1) << endl; 
		cin.ignore(200, '\n'); 
		getline(cin, userInput);

		cout << "How many seconds long is the song?\n"; 
		cin >> userIntInput; 
		collection[size].addSong(userInput, userIntInput);
	}
 }

//displays the collection 
void displayCollection(vector<string> &collection) 
{ 
	int totalSeconds;  
	int size = collection.size();  
	
	if (size > 0)  
	{ 
		cout << endl << setw(5) << left << "CD#" 
			 << setw(14) << "Artist" << setw(17) 
			 << "CD Title" << setw(13) << "CD Length" 
			 << setw(17) << "Song Title" << "Song Length\n\n"; 

		for (int count = 0; count < (size); count++) 
		{ 
			totalSeconds = getTotalSeconds(collection[count].getLengths());  // here is where i'm getting error code
			cout << left << setw(5) << (count + 1) << setw(14) 
				 << (collection[count].getArtist()) << setw(17) 
				 << (collection[count].getCDName()) << setw(13) 
				 << convertSeconds(totalSeconds); 

			if (collection[count].getSongs().size() > 0) / 
				{ 
					cout << setw(17) << collection[count].getSongs()[0] 
						 << convertSeconds(collection[count].getLengths()[0]) 
						<< endl; 
					for (int count2 = 1; count2 < (collection[count].getSongs().size()); count2++) //for each song after display on new lines 
					{ 
						cout << setw(49) << " " << setw(17) 
							<< collection[count].getSongs()[count2] 
							<< convertSeconds(collection[count].getLengths()[count2]) << endl; 
					} 
				} 
		cout << endl;
		} 
	}
 else 
 {
	 cout << "There are no cd entries to display\n"; 
 }
 cout << endl; 
} 
Anyone"?
http://www.cplusplus.com/forum/articles/40071/#msg216270

Also, if you could provide enough code in order to us to compile it and receive the same error messages that you are getting, that would be great.
Something I noticed while I was skimming.
On line 92, you are calling addSong(), but that's not a member of the std::string class. Perhaps, what you meant to do, was to have the collection vector be a vector of CDs?
Topic archived. No new replies allowed.