I am trying to use pow(2,a); and I am getting a error 'pow' ambigous call to over load function. I don't understand why, I added the cmath libarary. Here is the code.
#include <iostream>
#include <cmath>
using namespace std;
int binaryToDec(int);
int main()
{
binaryToDec(1110);
return 0;
}
int binaryToDec(int n)
{
int a=0;
int numTotal=0;
if(n%10 == 0){
a++;
numTotal+=0;
}
else if(n%10!=0)
a++;
numTotal+=pow(2,a); //here is where I get the error
binaryToDec(n / 10);
cout<<numTotal<<endl;
return numTotal;
}
any help would be great