You are viewing a single comment's thread. Return to all comments →
string caesarCipher(string s, int k) { string enc = ""; char salt = k % 26; int next; for (char c : s) { next = c + salt; if (c > 64 && c < 91) { c = next < 91 ? next : next - 26; } else if (c > 96 && c < 123) { c = next < 123 ? next : next - 26; } enc += c; } return enc; }
Seems like cookies are disabled on this browser, please enable them to open this website
Caesar Cipher
You are viewing a single comment's thread. Return to all comments →
C++11