Dasturlash uslublari va paradigmalar fanidan yozgan 1-topshirig’i




Download 23,05 Kb.
Sana09.12.2023
Hajmi23,05 Kb.
#114309
Bog'liq
1-topshiriq

Muhammad al-Xorazmiy nomidagi Toshkent Axborot Texnologiyalari Universiteti Dasturiy injiniring fakulteti 311_21-guruh talabasi Akbarov Muhammadalining


Dasturlash uslublari va paradigmalar fanidan yozgan 1-topshirig’i

#include


#include
#include
#include
using namespace std;
string generate_password(int length) {
string uppercase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
string lowercase = "abcdefghijklmnopqrstuvwxyz";
string numbers = "0123456789";
string special_characters = "!@#$%^&*()_-+=<>?";
string password;
password += uppercase[rand() % uppercase.length()];
password += lowercase[rand() % lowercase.length()];
password += numbers[rand() % numbers.length()];
password += special_characters[rand() % special_characters.length()];
for (int i = 4; i < length; i++) {
string all_characters = uppercase + lowercase + numbers + special_characters;
password += all_characters[rand() % all_characters.length()];
}
random_device rd;
mt19937 generator(rd());
shuffle(password.begin(), password.end(), generator);
return password;
}

int main() {


int num_passwords, length;
cout << "N = ";
cin >> num_passwords;
cout << "L = ";
cin >> length;
for (int i = 0; i < num_passwords; i++) {
string password = generate_password(length);
cout << password << endl;
}
return 0;
}
Dastur C++ tilida yozildi.

Download 23,05 Kb.




Download 23,05 Kb.

Bosh sahifa
Aloqalar

    Bosh sahifa



Dasturlash uslublari va paradigmalar fanidan yozgan 1-topshirig’i

Download 23,05 Kb.