const float SUCCESSFUL = 1.5;
class girl
{
public:
girl(float looking, float age){ m_looking = looking; m_age = age; };
float getLooking(){ return m_looking; };
float getAge(){ return m_age; };
private:
float m_looking;
float m_age;
};
class boy
{
public:
boy(float money, float looking){m_money=money; m_looking = looking; m_luck = rand()%100;};
bool suit(girl GIRL);
private:
float m_money;
float m_looking;
float m_luck;
};
bool boy::suit(girl GIRL)
{
float temp = m_money/100 + m_looking/100 + m_luck/100 - GIRL.getLooking()/100 - (30 - GIRL.getAge())/10;
if ( temp > SUCCESSFUL )
return true;
else
return false;
};
int main(int argc, char* argv[])
{
srand( (unsigned)time( NULL ) );
girl *pGirl = new girl(100, 20);
boy *pBoy = new boy(70, 80);
if ( pBoy->suit(*pGirl) )
printf("I made a girl friend. \n");
else
printf("I will go for the next one.\n");
return 0;
}
class girl
{
public:
girl(float looking, float age){ m_looking = looking; m_age = age; };
float getLooking(){ return m_looking; };
float getAge(){ return m_age; };
private:
float m_looking;
float m_age;
};
class boy
{
public:
boy(float money, float looking){m_money=money; m_looking = looking; m_luck = rand()%100;};
bool suit(girl GIRL);
private:
float m_money;
float m_looking;
float m_luck;
};
bool boy::suit(girl GIRL)
{
float temp = m_money/100 + m_looking/100 + m_luck/100 - GIRL.getLooking()/100 - (30 - GIRL.getAge())/10;
if ( temp > SUCCESSFUL )
return true;
else
return false;
};
int main(int argc, char* argv[])
{
srand( (unsigned)time( NULL ) );
girl *pGirl = new girl(100, 20);
boy *pBoy = new boy(70, 80);
if ( pBoy->suit(*pGirl) )
printf("I made a girl friend. \n");
else
printf("I will go for the next one.\n");
return 0;
}