Your problem is this line in decrypt
:
std::string text(oldText); // converts the array back into text
It does not convert 'oldText' back into text
; instead it declare a new local variable named test
. That new local variable conflicts with the parameter named text
. This is the line that is causing the C2082
. What you should have written is:
text = oldText;
Which is replace the contents of test
with what is in oldText
Although it would be simpler to skip that entirely and just return oldText
.
I don't get a C3861
when compling your code, plus the fact that you are showing the C2082
on the wrong line makes me think your source file is out of sync with your errors.