The null character '\0' is used as terminator for character arrays when used as strings but not for std::strings
Try to see what the output of this would be:
Btw, you can't simply cast a char to an int, you will get the ASCII value. You would need to do some arithmetic on chars to get the "correct" value: str[i] - ('a' - 1); //this gives 'a' == 1, 'b' == 2, etc
By now, however, ASCII is so ubiquitous and EBCDIC so obsolete, that it can be pretty much assumed that code points [0;128) belong to ASCII.
The fact that UCS is backwards compatible with ASCII guarantees that in the future 'A'|32=='a' will always be true.
More or less, the same applies for arithmetics other than two's complement and bytes that are not octets.
Hammurabi, your code works well but i can't get it to ignore spaces... And for the string problem i solved it by taking the easy way out by using a char array