Bool Problem

I need help figuring out why my bool statement isn't working. It should output "Is a palindrome" or "Is not a palindrome". However, it currently is outputting ASCII Code I believe.
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
#include <iostream>
#include <cmath>
#include <ctime>
#include <iomanip>
#include <fstream>
#include <string>
using namespace std;


int reverse(int num)
{
	int reverse = 0;
	while (num != 0)
	{
		int remainder = num % 10;
		reverse = reverse * 10 + remainder;
		num /= 10;
	}
	return reverse;
}

bool isPalindrome(int number)
{

	if (number == reverse(number))
	{
		number = true;
		cout << "It is a palindrome!";
	}
	else
	{
		number = false;
		cout << "It is not a palindrome!";
	}
	return number;
}

int main()
{
	bool isPalindrome(int number);
	int number = 0;
	cout << "Enter a number: ";
	cin >> number;
	cout << "Reversed number = " << reverse(number) << endl;
	cout << isPalindrome;
	return 0;
}
line 40 : duplicate declaration function & declaration on main
line 27 , 32: number is type int or bool?
line 45 : isPalindrome()
Last edited on
sounds good. Got it.
Topic archived. No new replies allowed.