Chapter 7, Problem 4 (and 3)

An Object-oriented Approach

Chapter 7, Problem 4 (and 3)

Postby mikey » Tue Mar 20, 2012 3:13 pm

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.
Posts: 3
Joined: Tue Mar 20, 2012 12:01 am
Location: NY

Return to Introduction to C++ for Financial Engineers (Duffy)

Who is online

Users browsing this forum: No registered users and 1 guest