C++ language implementation of the golden section method