Skip to content

Instantly share code, notes, and snippets.

@shnya
Created December 8, 2010 10:33
Show Gist options
  • Save shnya/733122 to your computer and use it in GitHub Desktop.
Save shnya/733122 to your computer and use it in GitHub Desktop.
Test
string decode(string cipherText, int shift)
{
size_t len = cipherText.size();
string res(cipherText);
for(size_t i = 0; i < len; i++){
int c = res[i] - 'A';
if(c - shift < 0)
c = 26 + (c - shift);
else
c = c - shift;
res[i] = c + 'A';
}
return res;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment