Palindrom and check for only lowercase letters

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • TOE022
    New Member
    • Feb 2008
    • 1

    Palindrom and check for only lowercase letters

    Hi!

    can anyone help me with this task?

    im creating a palindrom :

    write a recursic function whitch takes a stringobject(wh o only contains small letters and numbers) and checks if its a palindrom..
  • Ganon11
    Recognized Expert Specialist
    • Oct 2006
    • 3651

    #2
    What do you have so far?

    Comment

    • Simonius
      New Member
      • Feb 2008
      • 47

      #3
      I know that we're not supposed to post code if they have no coding but I'm doing an exercise which starts with checking if the word's a palindrom.
      My coding works but I was wondering if there's a more effective way.

      For the ts: my reasoning for this solution was this:
      -for a palindrom the first and last letter, second and the letter before the last, ... must be the same.
      -a string is an array of characters so I could just compare them.

      Code:
      Sorry friend...
      And for the lower case take a look at the cctype library it contains the function you need for the lowercase ;)
      Last edited by RedSon; Feb 25 '08, 03:58 PM.

      Comment

      • weaknessforcats
        Recognized Expert Expert
        • Mar 2007
        • 9214

        #4
        Yes, you should not be posting code but since the OP needs a recursive function and your solution does not use one, I have let the code stand.

        Comment

        • RedSon
          Recognized Expert Expert
          • Jan 2007
          • 4980

          #5
          Originally posted by weaknessforcats
          Yes, you should not be posting code but since the OP needs a recursive function and your solution does not use one, I have let the code stand.
          Sorry w4c, I didn't see your post before I removed the code. Usually we do not allow code in any question that can be commonly found in programming assignments. So, even if the user needs a recursive solution and someone posts an iterative solution we still do not allow it because if 3rd user comes in and searches for "palindrome " they will have an iterative solution.

          OPs, I encourage you to post code snippets of critical areas of your code that you are questioning the logic in or wondering why it does not work. Generally posting code snippets will not get your code deleted, whereas posting entire code files will.

          Comment

          • weaknessforcats
            Recognized Expert Expert
            • Mar 2007
            • 9214

            #6
            Right you are. I didn't think of that.

            Comment

            Working...