C++ Algebra learning