Pow function

closed account (zbREy60M)
1
2
3
4
5
cout << "\n\nWhat is the ellipticity of the objects? Enter 6, 7, 8, 9, for gravitars of ellipticity of 10^-x.\n\n";

cin >> e;

double E = float pow (10, - e);


I'm getting such errors as "Type float unexpected" when I remove the float it gets cranky and tells me

1>c:\users\adam\documents\visual studio 2008\projects\gravitar\gravitar\gravitar.cpp(94) : error C2668: 'pow' : ambiguous call to overloaded function
1> c:\program files (x86)\microsoft visual studio 9.0\vc\include\math.h(575): could be 'long double pow(long double,int)'
1> c:\program files (x86)\microsoft visual studio 9.0\vc\include\math.h(527): or 'float pow(float,int)'
1> c:\program files (x86)\microsoft visual studio 9.0\vc\include\math.h(489): or 'double pow(double,int)'
change the variable e to a double variable
The problem will be this:
double E = float pow (10, - e);
The compiler is telling you that the word float is unexpected here - do can't declare variables midway through another statement.

Anyway, float is completely unnecessary in that position as far as I can see, so just remove it. What were you intending it to do?
Last edited on
Topic archived. No new replies allowed.