Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- string wej, wyj;
- getline(cin, wej); // wej;
- string alfabet = "abcdefghijklmnoprstuwxyz";
- cout << alfabet.length();
- int n, m;
- cin >> n >> m;
- int f;
- for(int i = 0; i < wej.length(); i++)
- {
- if(!isalpha(wej[i]))
- {
- wyj += wej[i];
- continue;
- }
- f = alfabet.find(tolower(wej[i]));
- if(m == 1) f = f + n;
- if(m == 2) f = f - n;
- if(f > 24) f = f - alfabet.length();
- if(f < 0) f = f + alfabet.length();
- wyj += alfabet[f];
- if(isupper(wej[i])) wyj[i] = toupper(wyj[i]);
- }
- cout << wyj;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement