Any thoughts/suggestions on how to generalize the code to find root of any power of x?

I understand the function "return pow(x, n)-2" will give the nth root of 2. But how can we provide the function with the value of n from int main()? Can this be done without changing the solver class?

I have the same issue with Problem 3- I don't see how to provide the function with extra parameters and NOT change the solver class. The one solution I can think of is to create a class that contains parameters and a function, but was wondering if there is a more elegant/efficient way.