#include <iostream>
using namespace std;

class plant
{
public:
    int height;
    virtual int grow(int)= 0;
};

class seaweed: public plant
{
    int grow(int x)
    {
         return x*5;
    }
};
class oak: public plant
{
    int grow(int x)
    {
         return x*1.1;
    }
};

seaweed seaweed1;
oak oaktree1;

plant *listingArray[2] = {&seaweed1,&oaktree1};

int main()
{
    seaweed1.height=1;
    oaktree1.height=1;
    for (int i=0; i<2; i++)
    {
        listingArray[i]->height=1;
    }

for (int years=0; years<50; years++)
{
    for (int i=0; i<2; i++)
    {
        listingArray[i]->height=listingArray[i]->grow(listingArray[i]->height);
    }
    cout << "after "<<years<<" years:\n oak = "<<oaktree1.height<<"\nseaweed = "<<seaweed1.height<<endl;
}
return 0;
}