C++ program that approximates a root of mathematical function/expression