The Code-Bin
anagram
Posted by: Robert | November 19, 2010 @ 12:46am

C++ Code



Syntax Highlighting





Author Comments
(Anagrams) Write a function that checks whether two words are anagrams. Two words are anagrams if they are contain the same letters in any order. For example "silent" and "listen".

You must use the function header:

bool isAnagram(const string &s1, const string &s2)

to help you get started use implement sth like the following:

boo isAnagram(const string &sl, const string &sr)
{
int counts[256];
for (int = 0; i < 256; i++)
counts[i] = 0;
for (int i = 0; s1.Length(); i++)
counts[s1.at(i)]++;
}
Rating


4.70 / 8
27 Votes