CPSC250A Assignment 11 - Anagram

Due Friday September 16

An anagram is a word or phrase in which the letters can be rearranged, without adding or removing letters, into a new word or phrase.


The file anagram.cc contains the outline for a program that reads in two lines of text from the user, passes the two lines of text as a primitive strings to the undefined method Anagram, that returns a bool for whether the two strings are anagrams of each other. The Anagram method should ignore all non-alphabetic characters and should not be case sensitive. For example, the following two phrases should be recognized as an anagram by your program:

A decimal point
I'm a dot in place

In order to determine if a character is alphabetic, uppercase, or lowercase, take advantage of how ascii characters are represented. The characters a - z when cast to integers are 97 - 122 and the characters A - Z when cast to integers are 65 - 90. Do not use the functions in cctype. Be sure to test your code on multiple examples and on the cs server.


Submit your code on the course Inquire site.