Язык C++. Суть задачи, в том, что бы зашифровать или дешифровать заданный текст (методом Гронсфельда), с использованием модулей. Но проблема, в том, что, как бы я не старался исправить ошибки, прога всё равно нормально не работает(
| Код | #include <iostream> #include <fstream> #include <string.h> #include <cstdlib> #include <sstream> #include <ctime> #include <string> #include <algorithm>
using namespace std;
int n;
//Модуль ввода void vvod (const char) {
const char * aa = {"а, б, в, г, д, е, ё, ж, з, и, й, к, л, м, н, о, п, р, с, т, у, ф, х, ц, ч, ш, щ, ъ, ы, ь, э, ю, я, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, *, !, @, #, $, %, ^, &,', <, >, ?"}; cout<<"\t\t\tВыберете действие"<<endl; cout<<'\n'; cout<<"Для выбора действия - шифрование, введите 1"<<endl; cout<<"Для выбора действия - дешифрование, введите 2"<<endl; cout<<"------------------------------------------------------------------------------\n"; cin>>n; cout<<"\n----------------------------------------------------------------------------\n";
const char* a = "укроп"; }
//Модуль обработки 1 (шифрование) void shifrovania (int * arr) { if(n==1){ int * arr = new int[strlen("a")]; for(int i = 0; i < strlen("a"); ++i) { srand(time(0) * (i - 5)); arr[i] = rand() % 9; } string b; for(int i = 0; i < strlen("a"); ++i) { b.push_back(char("a"[i] + arr[i])); } cout << b << endl << endl; for(int i = 0; i < strlen(("a")); ++i) { cout << arr[i] << " "; } } }
//Модуль обработки 2 (дешифрование) void deshifrovania (int *arr) { else if(n==2){ int * arr = new int[strlen(a)]; string b; for(int i = 0; i < strlen(a); ++i) { b.push_back(char(a[i] + arr[i])); } } }
//Модуль вывода vvod vivoda (int * arr) { cout << b << endl << endl; }
int main() { setlocale (LC_ALL, "Russian"); const char * aa const char *a int * arr = new int[strlen(a)];
system ("pause"); return 0; }
|
|