I am trying to make a rabbit breeding program in c++. I keep getting an error under the period in this line...
RabbitsM.push_back(Rabbit());
I need to be able to put in whether the rabbits are female or male and what color they are. So what I was thinking is that I make two vectors (male and female) and I would like to have 4 slots in the vectors to have the color of the offspring (brown, white, black and spotted). The error I keep getting is...
Severity Code Description Project File Line
Error (active) no instance of overloaded function "std::vector<_Ty, _Alloc>::push_back [with _Ty=float, _Alloc=std::allocator<float>]" matches the argument list
Here is my source code...
class Rabbit {
int main()
{
for (int i = 0; i < 20; i++)
{
int rabbits = 5;
vector<float> RabbitsM;
vector<float> RabbitsF;
int sex = rand() % 2 + 1;
if (sex == 1)
{
int color = rand() % 5;
if (color == 1)//brown
{
RabbitsM.push_back(Rabbit());
}
else if (color == 2)//black
{
RabbitsM.push_back(Rabbit());
}
else if (color == 3)//white
{
RabbitsM.push_back(Rabbit());
}
else if (color == 4)//spotted
{
RabbitsM.push_back(Rabbit());
}
}
else
{
int color = rand() % 5 + 1;
int color = rand() % 5;
if (color == 1)//brown
{
RabbitsF.push_back(Rabbit());
}
else if (color == 2)//black
{
RabbitsF.push_back(Rabbit());
}
else if (color == 3)//white
{
RabbitsF.push_back(Rabbit());
}
else if (color == 4)//spotted
{
RabbitsF.push_back(Rabbit());
}
}
}
}
} Can someone please help me!