Page 2 of 2 FirstFirst 12
Results 11 to 12 of 12

Thread: Help with this question Please.

  1. #11
    Join Date
    Dec 2007
    Posts
    151
    Rep Power
    0

    Default

    Quote Originally Posted by Skele Drew View Post
    Well she has been here a long time before him, though not active ...
    never even took note of that
    CCNA looking for an opportunity

  2. #12
    Join Date
    Mar 2004
    Posts
    66
    Rep Power
    0

    Default

    Solution for solving a palyndrome number is:
    For Numbered Pals:
    1.convert to String
    2.then do a character replace from the said string into a blank string of the same length.
    3.then convert the new string back to an int and check for a match with the original int.
    4. If it matches then u know its a paly.


    For Alpha/Alphanum Pals:
    1.do a character replace from the said string into a blank string of the same length.
    2.do a string compare with both strings(the original and the newly created string variable of the same size as the original string)
    3. If it matches then u know its a paly.


    So how do u do a character reverse replace.

    1. First check the length of the String or character array, whicheva yuh use.
    2. Then say start a loop which loops the amount of times equal to the length of the string. Then say the first character, or arrayname[c] is equal to reversedarrayname[lengthofarray-c]

    One of the simplest ways to reverse a string, this method subtracts the current count from the length count of the string.

    Hope this helps.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •