Advertisement
Guest User

Untitled

a guest
Dec 9th, 2019
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.55 KB | None | 0 0
  1. #include<iostream>
  2. #include <iostream>
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7. string tekst;
  8. int k;
  9.  
  10. cout<<"podaj tekst do zaszyfrowania"<<endl;
  11. cin >>tekst;
  12. cout<<"podaj k"<<endl;
  13. cin >> k;
  14.  
  15. for(int i=0;i<=tekst.length();i++)
  16. {
  17. if(tekst[i]>=65 && tekst[i]<=90-k) tekst[i]=int(tekst[i])+k;
  18. else if(tekst[i]>=91-k && tekst[i]<=90) tekst[i]=int(tekst[i])-26+k;
  19. else if(tekst[i]>=97 && tekst[i]<=122-k) tekst[i]=int(tekst[i])+k;
  20. else if(tekst[i]>=123-k && tekst[i]<=122) tekst[i]=int(tekst[i])-26+k;
  21. }
  22. cout << tekst<<endl;
  23.  
  24. return 2137;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement