-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPratice.cpp
56 lines (50 loc) · 1.27 KB
/
Pratice.cpp
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
#include <iostream>
#include <string>
#include <map>
#include <vector>
#include <algorithm>
#include <sys/time.h>
#include "Main.h"
std::vector<std::string> Bank;
int Do()
{
time_t Seed;
srand(time(&Seed));
int Q = rand()%26;
std::cout << "What is '" << Bank[Q] << "'? >";
std::string A;
std::cin >> A;
std::transform(A.begin(), A.end(), A.begin(), ::toupper);
if (encryptionMap[A] == Bank[Q])
{
std::cout << "Good!\n\n";
return 1;
}
else
std::cout << "Wrong! Answer: " << decryptionMap[Bank[Q]] << "\n\n";
return 0;
}
int main()
{
for (int i,p = 0; i < 26; i++)
{
std::string Question;
if(i%2 == 0)
p++;
Question += (p + 'A' - 1);
Question += std::to_string(i%2);
Bank.push_back(Question);
}
std::cout << "[JEL - Pratice]\n";
int Max, Score;
std::cout << "How many question you want challenge? >";
std::cin >> Max;
for (int i = 0; i < Max; i++)
{
std::cout << "[Q" << i+1 << "/" << Max << "]";
std::cout << "[Score:" << Score << "] ";
Score += Do();
}
std::cout << "Pratice over! Your final score is " << Score << "\n";
std::cout << "Accuracy: " << float(Score)/float(Max)*100.f << "%\n";
}