Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include <iostream>
- using namespace std;
- int main()
- {
- string tekst;
- int k;
- cout<<"podaj tekst do zaszyfrowania"<<endl;
- cin >>tekst;
- cout<<"podaj k"<<endl;
- cin >> k;
- for(int i=0;i<=tekst.length();i++)
- {
- if(tekst[i]>=65 && tekst[i]<=90-k) tekst[i]=int(tekst[i])+k;
- else if(tekst[i]>=91-k && tekst[i]<=90) tekst[i]=int(tekst[i])-26+k;
- else if(tekst[i]>=97 && tekst[i]<=122-k) tekst[i]=int(tekst[i])+k;
- else if(tekst[i]>=123-k && tekst[i]<=122) tekst[i]=int(tekst[i])-26+k;
- }
- cout << tekst<<endl;
- return 2137;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement