You are viewing a single comment's thread. Return to all comments →
string caesarCipher(string s, int k) {
for(int i=0;i<s.length();i++){ if(s[i] >= 'A' && s[i] <= 'Z'){ s[i] = ((s[i] - 'A') + k)%26; s[i] += 'A'; } else if(s[i] >= 'a' && s[i] <= 'z'){ s[i] = ((s[i] - 'a') + k)%26; s[i] += 'a'; } else{ ;//do nothing } } return s;
}
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 →
string caesarCipher(string s, int k) {
}