Mathematical equations to C++ (prototype)