Solved
Creating a power program with an array
Posted on 2003-10-21
Hey all! Here is a problem that my teacher proposed in class. I need to write a template function that takes two arguments: an integer n and a variable v of a parameterized type. The function computes and returns the nth power of v. Also write a driver function (i.e. the main function) to ask the user to enter a positive integer (n). Now use the template function to compute the nth power of 8.5 and displayed the result, then use the template function to compute the nth power of 8 and displayed the result. Continue to ask the user for another integer and repeat the computation until the user gives a negative integer.
To be honest, I have no idea where to start. I know that I have to use an array (because that is the chapter we are in), but other than that I am lost. Please help. Thank you.