Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > Any Sample???

Reply
Thread Tools

Any Sample???

 
 
JT
Guest
Posts: n/a
 
      10-07-2005
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

 
Reply With Quote
 
 
 
 
mlimber
Guest
Posts: n/a
 
      10-07-2005
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-lit...t.html#faq-5.2

Cheers! --M

 
Reply With Quote
 
 
 
 
Mike Wahler
Guest
Posts: n/a
 
      10-07-2005
"JT" <> wrote in message
news: ups.com...
> 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


 
Reply With Quote
 
osmium
Guest
Posts: n/a
 
      10-07-2005
"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.



 
Reply With Quote
 
Marcus Kwok
Guest
Posts: n/a
 
      10-07-2005
"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
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
501 PIX "deny any any" "allow any any" Any Anybody? Networking Student Cisco 4 11-16-2006 10:40 PM
icmp weirdness - PIX 501 (does any really mean any??) news8080@yahoo.com Cisco 2 09-23-2005 04:04 PM
Anyone interested in getting any Certificationz from Microsoft, CISCO or any other IT CertificationzzzZ...?? get.certified@gmail.com Cisco 0 03-07-2005 03:09 PM
so what does IE or any of the IE shells have over firefox ? (any anti firefox ppl bother looking at recent plugins available?) *ProteanThread* Firefox 12 10-20-2004 08:31 AM
Does any one have any material for 70-015 Srinivas Iragavarapu MCSD 0 10-08-2003 05:48 AM



Advertisments