Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //szyfr vigenera
- #include <iostream>
- #include <cstring>
- using namespace std;
- int main () {
- int i, j;
- string slowo, klucz;
- char tab[26][26];
- for (i=0; i<26; i++) {
- for (j=0; j<26; j++)
- {
- if (i+j+65>90)
- tab[i][j]=(char)j+i+65-26;
- else
- tab[i][j]=(char)j+i+65;
- cout << tab[i][j] << " ";
- }
- cout << endl;
- }
- //---------------
- cin >> slowo;
- cin >> klucz;
- for (i=0,j=0; i<slowo.size(); i++,j++){
- if (j==klucz.size())
- j=0;
- slowo[i]=tab[slowo[i]-65][klucz[j]-65];
- }
- cout << "Zakodowany " << slowo << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement