Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int a=0, b=0;
- 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'};
- string wyraz, klucz;
- cout << "Podaj wyraz do szyfrowania:" << endl;
- cin >> wyraz;
- cout << "Podaj klucz:" << endl;
- cin >> klucz;
- int dlugosc=wyraz.length();
- for (int i=0;i<dlugosc;i++)
- {
- for (int j=0; j<26;j++)
- {
- if(wyraz[i]==alfabet[j]) a=j;
- if(klucz[i]==alfabet[j]) b=j;
- }
- cout << alfabet[(a+b)%26];
- }
- cin.ignore();
- getchar();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement