Any Sample???

J

JT

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
 
M

Mike Wahler

JT said:
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
 
O

osmium

JT said:
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.
 
M

Marcus Kwok

osmium said:
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".
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top