Convert fracsubr.c to C++