Convert ant.c to C++