Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- char codificat(char c, int k) {
- if(c == '_') c = ' ';
- else if ('a' <= c and 'z' >= c){
- c = c + 'A' - 'a';
- c += (k %26);
- if (c > 'Z') c += 'A' - 'Z' - 1;
- }
- return c;
- }
- int main() {
- int k;
- char c;
- while (cin >> k) {
- cin >> c;
- while (c != '.') {
- cout << codificat(c,k);
- cin >> c;
- }
- cout << endl;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement