C++ Math program