Convert soi1.c to C++