encoding/decoding arrays

I'm working on a program in Visual Studio that encodes and decodes a txt file of user names, passwords, and websites that has 3 levels of encoding/decoding. I have level 1 to display some gobbledygook that I guess is correct. My level 2 is encoding but only displays "Encoded" for each of the 10 lines. I have gone into debugging and can see the encrypted characters, but can't seem to figure out what to change to correctly display. I have worded it exactly the same as level 1.

Thank you,
Mark

//Decode level2
string decodeLevel2(string encodedString)
{
const int THREE = 3;
const int FOUR = 4;
string decodedString;
char decodedChar;
string tempVarFirst;
string tempVarLast;
string middle;
string buildStr;

for (int i = 0; i < encodedString.length(); i++)
{
if ((encodedString).length() > 2)
{
buildStr = encodedString;
buildStr = tempVarLast + middle + tempVarFirst;
middle = (encodedString).substr(1, encodedString.length() - 2);
tempVarLast = (encodedString).substr(encodedString.length() - 1, encodedString.length());
tempVarFirst = (encodedString).substr(0, 1);

}

decodedChar = (int)encodedString[i] + THREE;

if (i % 3 == 0 && i != 0)

decodedChar = (int)encodedString[i] + FOUR;
}
decodedString += decodedChar;


return decodedString;

I hope this is enough.
Last edited on
If you show us the code we might be able to help.
Topic archived. No new replies allowed.