Answer to Question #4936 in C++ for salma

Question #4936
whenever i compiled the following program this erroe apears ambiguous call to overload function
#include<iostream>
#include<cmath>
using namespace std;
int main()
{
int power;
int i=0;
int j=1;
while ((i<=10)&&(j<=11))
{
j=j+1;
i=i+1;
power=pow(int (i), int( j));
cout<<power<<",";
}
return 0;
}
1
Expert's answer
2011-11-03T09:07:26-0400
The problem is that there is not such prototype of pow function which takes two integers as parameters.
Instead of writing

power=pow(int (i), int( j));

you can try any from the following:

power=pow(double (i), j);
power=pow(long double (i), j);
power=pow(float (i), j);

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS