Advertisement
Guest User

dasfasfas

a guest
Mar 27th, 2015
222
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.  
  3. using namespace std;
  4. int main()
  5. {
  6. int a=0, b=0;
  7. char alfabet[]={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','u','p','q','r','s','t','u','v','w','x','y','z'};
  8. string wyraz, klucz;
  9. cout << "Podaj wyraz do szyfrowania:" << endl;
  10. cin >> wyraz;
  11. cout << "Podaj klucz:" << endl;
  12. cin >> klucz;
  13. int dlugosc=wyraz.length();
  14.  
  15. for (int i=0;i<dlugosc;i++)
  16. {
  17. for (int j=0; j<26;j++)
  18. {
  19. if(wyraz[i]==alfabet[j]) a=j;
  20. if(klucz[i]==alfabet[j]) b=j;
  21.  
  22. }
  23. cout << alfabet[(a+b)%26];
  24. }
  25.  
  26.  
  27. cin.ignore();
  28. getchar();
  29. return 0;
  30.  
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement