Hi I am a beginner in C++ programming.
I am required to use the power function for one of my programs and keep getting the error message.
Below is my program
1 #include <iostream>
2 #include <cmath>
3 using namespace std;
4
5 int main(){
6
7 //Declare and initalize variables
8 int i;
9 double result;
10 cin >> i;
11
12 result = pow (10,i);
13
14 cout << result << endl;
15
16 return 0;
17 }
But i keep getting
try.cpp: In function `int main()':
try.cpp:12: error: call of overloaded `pow(int, int&)' is ambiguous
/usr/include/iso/math_iso.h:63: note: candidates are: double pow(double, double)
/usr/sfw/lib/gcc/sparc-sun-solaris2.10/3.4.3/../../../../include/c++/3.4.3/cmath:361: note: long double std::pow(long double, int)
/usr/sfw/lib/gcc/sparc-sun-solaris2.10/3.4.3/../../../../include/c++/3.4.3/cmath:357: note: float std::pow(float, int)
/usr/sfw/lib/gcc/sparc-sun-solaris2.10/3.4.3/../../../../include/c++/3.4.3/cmath:353: note: double std::pow(double, int)
/usr/sfw/lib/gcc/sparc-sun-solaris2.10/3.4.3/../../../../include/c++/3.4.3/cmath:349: note: long double std::pow(long double, long double)
/usr/sfw/lib/gcc/sparc-sun-solaris2.10/3.4.3/../../../../include/c++/3.4.3/cmath:345: note: float std::pow(float, float)
as my error message. Any body would be kind enough to explain to me why ?