Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- int main()
- {
- char password[8];
- srand(time(NULL));
- for (int i = 0; i < 8; i++)
- {
- int n = rand() % 3;
- if (n == 0)
- {
- int s = rand() % 10;
- password[i] = '0' + s;
- }
- if (n == 1)
- {
- int s = rand() % 26;
- password[i] = 'a' + s;
- }
- if (n == 2)
- {
- int s = rand() % 26;
- password[i] = 'A' + s;
- }
- n = 0;
- }
- cout << password << endl << "Quieres generar otra key? (Y or N)\n";
- char a;
- cin >> a;
- if ((a == 'Y') || (a == 'y'))
- {
- cout << endl;
- return(main());
- }
- else
- {
- return(0);
- }
- system("pause");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement