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


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

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




#include <iostream.h>

int main(void)
{
    cin >> x;
    if( ( (x / 100000) % 10) == ( (x / 1) % 10) )
    {
        if( ( (x / 10000) % 10) == ( (x / 10) % 10) )
        {
            if( ( (x / 1000) % 10) == ( (x / 100) % 10) )
            {
                cout << "number is a palindrome" << endl;
            }
        }
    }
     return 0;
}

Ashley Harrison wrote:

>
>I need some help w/ a program for c++, i need to take a six-digit number
>entered by the user that could be a possible palindrome(a six digit
>number that reads the same front and back, i.e. 123321, 456654), the
>program has to determine if the number is a palindrome or not, and all i
>can use is if/else statements and the switch statement and logical
>operators, any ideas?
>
>Chris
>________________________________________________________________
>GET INTERNET ACCESS FROM JUNO!
>Juno offers FREE or PREMIUM Internet access for less!
>Join Juno today!  For your FREE software, visit:
>http://dl.www.juno.com/get/web/.
>





References: