an interesting exercise by Accelerated C++

U

utab

Exercise 5.10 from Accelerated C++ by Andrew Koenig

Palindromes are words that are spelled the same right to left as left
to right. Write a program to find all the palindromes in a dictionary.
Next, find the longest palindrome.

How do u think you can supply a dictionary to a program? The examples
are real world problems I have to accept :( but they must be in the
context of a newcomer can cope and learn without discourage. This is my
humble idea.

Any comments...

Thx.
 
D

Dietmar Kuehl

utab said:
Exercise 5.10 from Accelerated C++ by Andrew Koenig
How do u think you can supply a dictionary to a program?

Since it is very likely that Andrew Koenig had some UNIX exposure
I would guess that he considers the presence of /usr/dict/words
to be a given - as would I (just to learn that it is called
/usr/share/dict/words on the Linux system I'm using...).
The examples
are real world problems I have to accept :( but they must be in the
context of a newcomer can cope and learn without discourage. This
is my humble idea.

Any comments...

I assume your problem is the absence of a dictionary file: just
get one or create one to test with. Reading a file containing
words shouldn't be a problem...
 
R

Rolf Magnus

utab said:
Exercise 5.10 from Accelerated C++ by Andrew Koenig

Palindromes are words that are spelled the same right to left as left
to right. Write a program to find all the palindromes in a dictionary.
Next, find the longest palindrome.

How do u think you can supply a dictionary to a program?

The easiest would be just a plain simple text file.
 
U

utab

Thanks,

I am also using Linux(newbie on that also)

So I can try on that file if I have problems I will drop by again
 

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,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top