Hi, I'm new to this. I copy and pasted the code and then changed line 28. It compiles and runs but freezes when it gets to the decrypt function. I tried it in Windows and Linux. Compiled with g++ in both cases.
I'm confused by the "* ePtr" part. Should it be initialized to something in the beginning of the for loop? Also it looks like an iterator but up to this point all I've done with iterators requires declareing the iterator in int main() or globally like for (vector<string>::iterator).
That's because Grey Wolf made a typo when writing his response. Line 28 should read
for( ; * ePtr != '\0'; ++ ePtr ) --(* ePtr);
The encode function just adds one to every letter.
The decode function just subtracts one from every letter.
They are essentially the same function, except that the OP wrote one using an integer index into the string, and the other by manipulating the string pointer itself.