CS-285 Lab 4

 

Week #5:            Thursday, October 4, 2001

Date Due:            Friday, October 12, 2001

 

In chapter 7 of the text, the author illustrates the use of STL strings, iterators, and generic algorithms by implementing several versions of a palindrome program.  In a similar manner, these examples could be modified to solve a related problem of identifying anagrams.  Two words are said to be anagrams if they are composed of the same characters, but in different order.  For instance, the words ‘rescue’ and ‘secure’ are anagrams.  Write a C++ program that takes two strings and determines if they are anagrams.  Use the palindrome examples from the text as a model for your program.  Be sure to use STL strings, iterators, and generic algorithms in your solution as the author suggests.  Demonstrate the proper workings of your program by supplying pairs of strings that only recognize anagrams.  (Hint:  The sort generic algorithm is useful!)

 

Work in pairs (2 people per team) for this assignment, following the eXtreme Programming (XP) practices.  As always, your source code should be well commented, and a separate written report, which details your design, implementation, and testing of the project is required.  If you get the basics working early, add more functionality to the assignment, such as the ability to search for anagrams in a dictionary.  Also, don’t forget to record your time spent on the assignment.  I’ve placed two worksheets on the course web page:  one which assists you in logging time, and the other for logging defects which arise in development of the project.