Script that generate passwords
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

33 lines
731 B

#include <iostream>
#include <cstdlib>
#include <string>
#include <fstream>
using namespace std;
int main()
{
int uAmount, uLength, rChar;
string chars, uFile;
chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%^&*()_+?><|:,'";
cout << "Amount:";
cin >> uAmount;
cout << "Lenght:";
cin >> uLength;
cout << "File:";
cin >> uFile;
ofstream out;
out.open (uFile + ".txt");
for (int i = 0; i < uAmount; i++)
{
string password = "";
for (int b = 0; b < uLength; b++)
{
rChar = rand() % chars.length();
password += chars[rChar];
}
out << password << endl;
}
out.close();
}