Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cctype>
- using namespace std;
- // string decrypt(string msg, int key)
- string decrypt(string msg)
- {
- int key = 3;
- for (int i = 0; i < msg.length(); i++)
- {
- if (isupper(msg[i]))
- msg[i] = (msg[i] - 'A' - key) % 26 + 'A';
- else if (islower(msg[i]))
- msg[i] = (msg[i] - 'a' - key) % 26 + 'a';
- }
- return msg;
- }
- int main()
- {
- string message;
- getline(cin, message);
- cout << decrypt(message) << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement