Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "pch.h"
- #include <fstream>
- #include <string>
- #include <algorithm>
- #include <iostream>
- using namespace std;
- //Объявляем массив символов русского и английского алфавита
- string alpha = "абвгдеёжзийклмнопрстуфхцчшщъыьэюя,-.";
- int code(char str)
- {
- for (int i = 0; i < 33; i++) {
- if (str == alpha[i])
- return i;
- }
- }
- int main() {
- system("chcp 1251");
- system("cls");
- setlocale(LC_ALL, "Russian");
- ifstream start("start.txt");
- ofstream output("out.txt");
- char alphaB[20][2];
- string message;
- string key;
- string decode;
- getline(start, key);
- getline(start, message);
- cout << endl;
- int o;
- int ukazi = 0;
- int ukazj = 0;
- for (int i=0;i<message.length();++i) {
- char buf = (message[i] ^ key[i%key.length()]);
- output <<buf<<' ';
- decode += buf;
- }
- for (int i = 0; i < decode.length(); ++i) {
- char buf = (decode[i] ^ key[i%key.length()]);
- cout << buf << ' ';
- }
- cout << endl;
- system("pause");
- return 0;
- }
Add Comment
Please, Sign In to add comment