void fishing(vector<Fish*> &basket);
int printBasket(vector<Fish*> &basket);
int main()
{
vector<Fish*> FishVec;
Fish* aFish;
int totalweight=0;
int i=0;
while (totalweight<15000)
{
fishing(FishVec);
aFish=FishVec.at(i);
aFish->printMe();
if (aFish->acceptable())
{
totalweight+=aFish->getWeight();
cout<<"total weight:"<<totalweight<<endl;
cout<<" Has been put in the basket"<<endl;
}
else
{
cout<<" Was released"<<endl;
}
i++;
cout<<endl;
}
}
void fishing(vector<Fish*> &basket)
{
int i=RandomInt(1,4);
Fish* aFish;
if (i==1)
{
cout<<"caought:";
aFish=new AustralianBass();
basket.push_back(aFish);
}
else if(i==2)
{
cout<<"caought:";
aFish=new ShortFinedEel();
basket.push_back(aFish);
}
else if (i==3)
{
cout<<"caought:";
aFish=new EelTailedCatfish();
basket.push_back(aFish);
}
else if (i==4)
{
cout<<"caought:";
aFish=new GippslandPerch();
basket.push_back(aFish);
}
}
int printBasket(vector<Fish*> &basket) //suposed to be print content of the basket but it is not working what is wrong with this .
{
Fish* aFish;
for(int i=0;i<basket.size();i++)
{
aFish=(basket.at(i));
aFish->printMe();
}
return 0;
}
bhuwanrc 0 Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.