/* the thing is that i need to check if a given number (n) is a palindrome. i also used limits.h to identify if the number is
is exceeding the limit. i came up with this beut it's no good. any ideas? */
#include <iostream>
#include <stdlib.h>
#include <limits.h>
#include <math.h>
using namespace std ;
int main ()
{
int a, n, m=0, t ;
cout<<"Enter query number:"<<endl ;
cin>>n ;
t=n ;
while (n)
{
{
a=n%10 ;
n=n/10 ;
m=m*10+a ;
{
if (INT_MAX-n<a)
cout<<"overload" ;
}
}
if (t==m)
cout<<t<<"this number is already a palindrome"<<endl ;
else
cout<<t<<"this number is not a palindrome"<<endl ;
}
return 0 ;
}
royi.navon 0 Newbie Poster
tinstaafl 1,176 Posting Maven
royi.navon 0 Newbie Poster
NathanOliver 429 Veteran Poster Featured Poster
tinstaafl 1,176 Posting Maven
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.