[TIB] Re: [OT] C++ help


[Prev][Next][Index][Thread]

[TIB] Re: [OT] C++ help




Here is the simplest way to do it.. Input your number as a character string
and compare each character..
Let me know what you think,
Kevin

# include <iostream.h>
int main()
{    char palidrome[6];
     cout<<"Please input 6 digit number: ";
     cin>>palidrome;
     if (    palidrome[0]==palidrome[5] && palidrome[1]==palidrome[4] &&
palidrome[2]==palidrome[3]   )
          cout<<"Your number is a palidrome."<<endl;
     else
             cout<<"Your number is not a palidrome."<<endl;
 return 0;
 }