#include <iostream>
#include <string>
#include <cstdlib>
#include <ctime>
#include <Windows.h>
using namespace std;
string generateCaptcha() {
string choices = "1234567890";
string captcha;
for (int i = 0; i < 5; i++) {
int r = rand() % choices.size();
captcha += choices[r];
}
return captcha;
}
int main() {
srand(time(0));
while (true) {
string captcha = generateCaptcha();
cout << "Captcha: " << captcha << endl;
clock_t start_time = clock();
string result;
cin >> result;
if (result == captcha) {
double elapsed_time = double(clock() - start_time) / CLOCKS_PER_SEC;
cout << "You entered the captcha in " << elapsed_time << " sec" << endl;
}
else {
cout << "Incorrect characters entered." << endl;
}
}
return 0;
}