I wrote the other day the descrambler of the Caesar cipher in C ++. But there was a problem with the encryption id. The compiler writes that it is not defined. Specified prototypes of void Crypt(); functions void Crypt(); and void encrypt(); before use. Did not help. I left the source code of the program below.
The program is written in Visual Studio 2017. Error code E0020 (if required).
#include "pch.h" #include <iostream> #include <vector> #include <string> using namespace std; int main() { string s; getline(cin, s); vector<int> vec(26); for (auto& c : s) { if (c >= 'a' && c <= 'z') vec[c - 'a']++; else if (c >= 'A' && c <= 'Z') vec[c - 'A']++; } int max_index = 0; for (int i = 1; i < 26; i++) { if (vec[i] > vec[max_index]) max_index = i; } int key = max_index - 4; while (key < 0) key += 26; cout << encryption(s, 26 - key) << endl; } What is wrong, I do not know. I tried to compile with this error, but the results are not very good. Decipher Caesar did not work. Who met with such a problem and knows the solutions please write.
encryption()function? For I also do not see her ads in your code. - Mikhail Murugovvoid encrypt();add before themainfunction, then you skipped the parameters (judging by your call,stringandint). - Mikhail Murugov