Palindrome program

I'm writing a program to check whether or not an integer is a palindrome or not. (whether or not it can be read both ways, e.g 123454321 is a palindrome, 12345 is not.)

Here is the code, I keep getting an error in line 41 (call of overloaded pow(int, int) is ambiguous). Any help would be appreciated, thanks:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#include <iostream>
#include <cmath>

using namespace std;

bool isPalindrome(int);

int main()
{
	int number;

    cout << "Enter a positive integer: ";
    cin >> number;

	if(isPalindrome(number))
		cout << number << " is a palindrome." << endl;
	else
		cout << number << " is not a palindrome." << endl;

    return 0;
}

bool isPalindrome(int num)
{
	int i, limit, power, temp, first, last, length=0;

	temp=num;

	while(temp>0)
	{
		temp=temp/10;
		length++;
	}

	temp=num;
	limit=length/2;

	for(i=0; i<limit; i++)
	{
		first=temp%10;
		power=pow(10,length-1);
		last=temp/power;
		if(first != last)
			return false;

		temp=temp%power;
		temp=temp/10;
		length=length-2;
	}

	return true;
}
pow is a C function. In C++, due to the problems that occur with fraction exponents (what would pow(-3,0.5) do?), it uses class called complex (http://www.cplusplus.com/reference/std/complex/complex/). Either learn that, or make your own intPow() function.

Complex numbers are annoying, aren't they?
Topic archived. No new replies allowed.