-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
71 lines (63 loc) · 1.77 KB
/
main.cpp
File metadata and controls
71 lines (63 loc) · 1.77 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#include "AHC.h"
#include <iostream>
#include <chrono>
#include <random>
#include <string>
#include <fstream>
#include <thread>
#include <windows.h>
#include "utils.h"
void read2files(int index, int start, int end)
{
std::string filename = "../output/output_" + std::to_string(index) + ".txt";
std::ofstream out(filename);
for (int k = start; k <= end; k++)
{
for (int i = 1; i <= 1000; i++)
{
AHC ahc;
std::string input = "";
for (int j = 0; j < i; j++)
{
input += (char)utils::generateRandomNumber(31, 31 + k); // 31-126
}
std::string encode_ret = ahc.encode(input);
out << 7 * input.size() << "," << encode_ret.size() << std::endl;
}
}
out.close();
}
int main()
{
// std::vector<std::thread> threads;
// int index = 0;
// for (int i = 0; i < 90; i += 10)
// {
// threads.emplace_back(std::thread(read2files, index, i, i + 9));
// index++;
// }
// for (auto &t : threads)
// {
// t.join();
// }
AHC ahc;
std::string input = "";
std::cout << "Please input a string: ";
std::getline(std::cin, input);
std::string encode_ret = ahc.encode(input);
std::cout << "encode: " << encode_ret << std::endl;
// int msgboxID = MessageBoxA(
// NULL,
// "Do you want to decode?",
// "Decode Confirmation",
// MB_ICONQUESTION | MB_YESNO);
// if (msgboxID == IDYES)
// {
// std::string decode_ret = ahc.decode(encode_ret);
// std::cout << "decode: " << decode_ret << std::endl;
// }
std::string decode_ret = ahc.decode(encode_ret);
std::cout << "decode: " << decode_ret << std::endl;
system("pause");
return 0;
}