Hello
I'm trying to make a simple function to Rot13 strings and it's not working.I ran it through my debugger and it works until it get to the top of the loop again???Then some of the chars are rot13ed and some stay the same.
void Rot13(std::string &buffer)
{
int inc;
for(inc = 0;buffer[inc] != '\0';inc++)
{
if(buffer[inc] >= 'a' && buffer[inc] <= 'z')
{
if(buffer[inc] < 'n')
{
buffer[inc] += 13;
}
if(buffer[inc] >= 'n')
{
buffer[inc] -= 13;
}
}
if(buffer[inc] >= 'A' && buffer[inc] <= 'Z')
{
if(buffer[inc] < 'N')
{
buffer[inc] += 13;
}
if(buffer[inc] >= 'N')
{
buffer[inc] -= 13;
}
}
else
{
continue;
}
}
}