Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: need help please.... with turbo C  (Read 3243 times)

0 Members and 1 Guest are viewing this topic.

Flux

    Topic Starter


    Rookie

  • i am aware that most of my questions are stupid.
    need help please.... with turbo C
    « on: September 04, 2009, 05:44:17 AM »
    guys i need help... my teacher wanted us to make a program that gets a name 50 letters and displays it backwards like level=level and prints whether it is a palindrome or not
    here it is


     create a C program called palindrome(), that will ask the user to enter a word.  Then the program will change the word entered in its reverse order.  If the Word in reverse form is still the same word, then it is a palindrome, otherwise it is not a palindrome.

    sample output:

    Enter a Word:  Level
    level is a palindrome


    Enter a Word: Hello
    olleh is not a palindrome
    its always better to give people the impression that you're stupid than to open your mouth and remove all doubts.

    Flux

      Topic Starter


      Rookie

    • i am aware that most of my questions are stupid.
      Re: need help please.... with turbo C
      « Reply #1 on: September 04, 2009, 06:10:16 AM »
      its on Turbo C guys...please need some help
      its always better to give people the impression that you're stupid than to open your mouth and remove all doubts.

      BC_Programmer


        Mastermind
      • Typing is no substitute for thinking.
      • Thanked: 1140
        • Yes
        • Yes
        • BC-Programming.com
      • Certifications: List
      • Computer: Specs
      • Experience: Beginner
      • OS: Windows 11
      Re: need help please.... with turbo C
      « Reply #2 on: September 04, 2009, 08:58:23 AM »
      what do you have so far? Any ideas on how you'd go about it? (algorithm?)
      I was trying to dereference Null Pointers before it was cool.

      Salmon Trout

      • Guest
      Re: need help please.... with turbo C
      « Reply #3 on: September 04, 2009, 10:15:40 AM »
      I think the lesson is probably over.

      smeezekitty

      • Guest
      Re: need help please.... with turbo C
      « Reply #4 on: September 04, 2009, 10:06:09 PM »
      thats so easy
      Code: [Select]
      int palindrome(char *input){
      char buffer[49],buffer2[49];
      strcpy(buffer, input);
      strcpy(buffer2, input);
      strrev(buffer);
      if(strcmp(buffer, buffer2) == 0){return (1);}
      return (0);
      }
      returns 1 if it is a palindrome and 0 if it is not