We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Algorithms
- Strings
- Caesar Cipher
- Discussions
Caesar Cipher
Caesar Cipher
Sort by
recency
|
1280 Discussions
|
Please Login in order to post a comment
include
using namespace std; int main() { string s; int cipher; cin >> cipher; cin >> s; cin >> cipher; for(char &c:s) { if(isalpha(c)){ char a = isupper(c)? 'A':'a'; c = a + (c - a + cipher) % 26; } } cout << s ; return 0; } `
Javascript
Here is my c++ solution, you can watch the explanation here : https://youtu.be/KApgpiqqX20
C++ solution: