#include <iostream>
#include <vector>
using namespace std;
const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
// توليد جميع الكلمات بالترتيب
bool generatePasswords(string &target, int length, string current, long long &attempts) {
if ((int)current.size() == length) {
attempts++;
if (current == target) {
cout << "تم العثور على كلمة المرور!" << endl;
cout << "كلمة المرور هي: " << current << endl;
cout << "عدد المحاولات: " << attempts << endl;
return true; // وجدنا الكلمة
}
return false;
}
for (char c : chars) {
if (generatePasswords(target, length, current + c, attempts)) {
return true; // نوقف البحث
}
}
return false;
}
int main() {
string target;
cout << "ادخل كلمة المرور الصحيحة: ";
cin >> target;
long long attempts = 0;
int minLength = 12, maxLength = 16;
for (int len = minLength; len <= maxLength; len++) {
cout << "جاري المحاولة بطول " << len << " ..." << endl;
if (generatePasswords(target, len, "", attempts)) {
break;
}
}
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: