Convert evolve.c to C++