I couldn't solve it in c++ can you help me

Write a program that asks the user to prompt an Integer number and then test whether it is Palindrome Numbers or not.
The following are Palindrome numbers:
1. 22
2. 333
3. 67876
4. 44444
5. 123454321
Hint: read it as a std::string and then keep comparing ith and (n-1-i)th characters.
Hi abhishekm71 Thank you But I am new in the site I am a beginner I didn't understand what you said ?? can you help me more??
I don't want to give you entire code.

The basic algorithm is as follows:

1. Read the number as a string.
std::string number;
std::cout << "Please enter a number" << std::endl;
std::cin >> number;

2. Using a 'for' loop, iterate over the string characters and keep comparing the ith characters with (length - 1 - ith) character.

3. If all comparisons give 'equal' result, then the number is a palindrome. Else not.
You could edit your post to move it to the "Beginners" forum.

Courses usually provide info first and then give homework that depend on that info. The purpose of homework is to learn. You do learn best by doing.

Even though you may be a beginner, you must know something. Use that and do as much you can. Then show the result.
abhishekm 71 I know I don't want to give it to me but the problem that I don't understand it clearly and especially Palindrome
and keskiverto thank you I know that's why I signed up here...
The loop looks two characters at a time, one from both ends of the word. If the are not the same, then the word is not a palindrome.

There is a way to hide the loop by using existing library code. First, make a copy of the word (std::string copy constructor). Then reverse that copy (std::reverse). Last, test the equality of the reversed copy and the original (std::string::operator==).

Start simple. Make a for-loop that prints out every character of the word, one at a time, and the index of that character.
bool F(int number) //2013 - 11 - 02
std::string y = std::to_string(number);
std::string x = std::to_string(number);

for (int b = 0; b < x.length() / 2; b++)
std::swap(x[b], x[x.length() - b - 1]);
if (y == x)
return 1;
return 0;

change int to unsigned long long,if you want to check the palindromation of huge number
I found it ... it as follows

#include <iostream>
#include <conio.h>
using namespace std;
int main()

int x,y,sum=0,z;
cout <<"Enter a number:";




cout<<"The number you entered is a Palindrome."<<endl;


cout<<"The number you entered is not a Palindrome."<<endl;
getch ();
return 0;

Thanks a lot
Topic archived. No new replies allowed.