I've read around and made this code to loop through my two strings and add up all of the ascii values of the characters in them. However, it's not working...it's not even iterating. When I look at the cout for h and hi, I get 112 & 205976. Shouldn't it be two lines 104 and 209?
I do a lower case conversion on both strings just before I do this code, but I don't see how that would cause me any problems.
I'm trying to compare two strings to see if they are anagrams or not. If I make both lower case so if they input them in upper case it wouldn't matter, then convert them both to ascii values and then compare those values to each other, if they are both the same ascii values they will be anagrams.
Thanks.
for (c=0;c < phrase1.length();c++)
{
asciiphrase1 = asciiphrase1 + int(phrase1[c]);
c++;
cout<<asciiphrase1<<endl;
}
for (d=0;d < phrase2.length();d++)
{
asciiphrase2 = asciiphrase2 + int(phrase2[d]);
d++;
cout<<asciiphrase2<<endl;
}