Advertisement
Guest User

twoj stary

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