Any Sample???

Discussion in 'C++' started by JT, Oct 7, 2005.

  1. JT

    JT Guest

    Write a program that read a line of text, changes each uppercase letter
    to lowercase and places each letter both in a queue and onto a stack.
    The program should then verify whether the line of text is a palindrome


    Output:

    Please enter a line of text
    I am A.I


    i AM a.i

    This is a palindrome
    JT, Oct 7, 2005
    #1
    1. Advertising

  2. JT

    mlimber Guest

    JT wrote:
    > Write a program that read a line of text, changes each uppercase letter
    > to lowercase and places each letter both in a queue and onto a stack.
    > The program should then verify whether the line of text is a palindrome
    >
    >
    > Output:
    >
    > Please enter a line of text
    > I am A.I
    >
    >
    > i AM a.i
    >
    > This is a palindrome


    See http://www.parashift.com/c -faq-lite/how-to-post.html#faq-5.2

    Cheers! --M
    mlimber, Oct 7, 2005
    #2
    1. Advertising

  3. JT

    Mike Wahler Guest

    "JT" <> wrote in message
    news:...
    > Write a program that read a line of text, changes each uppercase letter
    > to lowercase and places each letter both in a queue and onto a stack.
    > The program should then verify whether the line of text is a palindrome
    >
    >
    > Output:
    >
    > Please enter a line of text
    > I am A.I
    >
    >
    > i AM a.i
    >
    > This is a palindrome


    Show us (the exact code of) what you've tried, explain specifically what
    problems you're having, and you'll get plenty of help with this.

    Nobody here will do it for you.

    -Mike
    Mike Wahler, Oct 7, 2005
    #3
  4. JT

    osmium Guest

    "JT" <> wrote:

    > Write a program that read a line of text, changes each uppercase letter
    > to lowercase and places each letter both in a queue and onto a stack.
    > The program should then verify whether the line of text is a palindrome
    >
    >
    > Output:
    >
    > Please enter a line of text
    > I am A.I
    >
    >
    > i AM a.i
    >
    > This is a palindrome


    But it is not a result of running the program you were asked to write. The
    program you write will not produce any upper case letters. The exercise is
    such that if you start writing you will not run into any blind alleys and
    have to discard a significant amount of work. So start writing and when you
    get stuck, *then* post a question.

    If you require the user to type only letters as input, it will be easier and
    get you started in a more painless fashion. Get clarification as to what is
    expected in the punctuation area, and change what you have later on, if
    necessary. The decimal point in your sample looks like magic, not a
    computer program.
    osmium, Oct 7, 2005
    #4
  5. JT

    Marcus Kwok Guest

    "JT" <> wrote:
    >> Write a program that read a line of text, changes each uppercase letter
    >> to lowercase and places each letter both in a queue and onto a stack.
    >> The program should then verify whether the line of text is a palindrome
    >>
    >>
    >> Output:
    >>
    >> Please enter a line of text
    >> I am A.I
    >>
    >>
    >> i AM a.i
    >>
    >> This is a palindrome


    osmium <> wrote:
    > But it is not a result of running the program you were asked to write. The
    > program you write will not produce any upper case letters.


    Looking back at it, it seems that instead of checking whether or not the
    text is a palindrome, the example that he gave just toggles the case
    (i.e., upper case or lower case) of each letter.

    > If you require the user to type only letters as input, it will be easier and
    > get you started in a more painless fashion. Get clarification as to what is
    > expected in the punctuation area, and change what you have later on, if
    > necessary.


    I agree, he will need to find out whether punctuation should be included
    or not. Most of the times that I have seen people refer to palindromes,
    they only consider the order of the letters, and not the spacing or
    punctuation, but his requirements may be different. However, based on
    (my) common convention, it would indeed be a palindrome, but it would
    not be one if punctuation/spacing is significant.

    > The decimal point in your sample looks like magic, not a
    > computer program.


    See my first sentence.


    To JT,
    Please double-check your definition of "palindrome".

    --
    Marcus Kwok
    Marcus Kwok, Oct 7, 2005
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Jake
    Replies:
    0
    Views:
    534
  2. Tim Chase
    Replies:
    0
    Views:
    64
    Tim Chase
    Feb 16, 2014
  3. Terry Reedy
    Replies:
    0
    Views:
    70
    Terry Reedy
    Feb 16, 2014
  4. Tim Chase
    Replies:
    0
    Views:
    79
    Tim Chase
    Feb 16, 2014
  5. Ned Batchelder
    Replies:
    0
    Views:
    71
    Ned Batchelder
    Feb 16, 2014
Loading...

Share This Page