The question asks for two numbers to be entered and the first number is to be raised to the power of the second number entered. The problem I am having is when I go to compile my program I get a logic error, and when I include the actual function in my function call the program will not compile and give me the error: ambiguous call to overloaded function. Any help that can be given is and will be greatly appreciated. Here is my code with the pow() function included in the function call:
#include <iostream>
#include <cmath>
using namespace std;
void powfun(long x, long y);
int main()
{
long firstnum, secnum;
cout << "\nPlease enter a positive integer: ";
cin >> firstnum;
cout << "\nGreat! Now please enter a second positive integer: ";
cin >> secnum;
powfun(firstnum, secnum);
system ("pause");
return 0;
}
void powfun(long x, long y)
{
long result;
result = pow(x, y);
cout << "\nThe answer is: " << result << endl;
return;
}