Hey guys, so I'm new with working with pointers and classes, and I'm trying to like a wine(in its own class) with a winery (another class). But I'm having some trouble, my program exits with the error segment core dump. I think it has something to do with the vectors not having enough room? but I cant figure out why exactly what is wrong. any help would be appreciated, let me know if you need to see any of my function definitions or anything else.
#include "Lab3.h"
int main () {
string n, t, wn, str, tow, stat,c, cont;
//double p;
printSignature();
vector<WineryName*> winName;
bool more = true;
while (more)
{
cout << "Please enter the winery's name: (no to quit)";
getline(cin, wn);
if (wn == "no")
{
more = false;
}
else
{
winName.push_back(new WineryName(wn));
}
}
vector<Wine*> wine;
more = true;
while (more) {
cout << "Enter wine name " ;
string n;
getline (cin, n);
if ( n =="no") more = false;
else
{
Wine* wine = new Wine(n);
string wineryname;
cout << "enter the winerys name:";
getline (cin, wineryname);
wine->setWineryName(find(winName, wn));
//wine.push_back(wine); // Haveing trouble geting this to work as well
}
}// program exits here (segment core dump)
cout << "youve made it out of the while loop";
for (int i = 0; i < 5; i++) {
cout <<"youve made it to the for loop";
wine[i]->print();
cout << "wine index should have been printed";
}
return 0;
}