pow problem

Hello. I am working on code::blocks.
Here the problem. When i use using namespase std; gives error call. Why is that?
Thank's
jim

1
2
3
4
5
6
7
8
9
10
11
12
13
/* pow example */
#include <stdio.h>
#include <math.h>

using namespase std; // without this all is ok.

int main ()
{
  printf ("7 ^ 3 = %lf\n", pow (7,3));
  printf ("4.73 ^ 12 = %lf\n", pow (4.73,12));
  printf ("32.01 ^ 1.54 = %lf\n", pow (32.01,1.54));
  return 0;
}
Last edited on
pow have many overloads, none of which takes 2 ints as arguments. So pow(7,3) will be ambiguous. try using pow (7.0,3) so that 7 is a double
7 must be the 7.0 and all are ok.
Thank's
strange that adding using namespace std makes the error come. I know that C only had the function taking doubles, perhaps the overload are under std, though I wouldn't expect that.
Topic archived. No new replies allowed.