You are viewing a single comment's thread. Return to all comments →
c++
string caesarCipher(string s, int k) { std::string result; for(char c : s){ if(c >= 'A' && c <= 'Z'){ result += ('A') + (c - 'A' + k)%26; } else if(c >= 'a' && c <= 'z'){ result += ('a') + (c - 'a' + k)%26; } else{ result+=c; } } return result; }
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++