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
|
#include <iostream>
#include <string>
#include <windows.h>
#include <ctime>
using namespace std;
int main()
{
locale swedish("swedish");
locale::global(swedish);
cout<<"WELCOME PRESS ENTER TO GENERATE A PASSWORD!" << endl << endl;
cin.get();
while (true)
{
srand(time(0));
char characters[71] = { '0','1', '2', '3','4','5','6','7','8','9','a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'y', 'x', 'z','A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'Y', 'X', 'Z','!','#','¤','%','&','*','@','$','£' };
string password;
for (int n = 0; n <= 7; n++)
{
password = password + characters[rand() % 70];
}
cout << "YOUR PASSWORD:" << endl;
cout << password << endl << endl;
cout << "PRESS ENTER TO GENERATE ANOTHER PASSWORD!" << endl;
cin.get();
}
return 0;
system("pause");
}
|