-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcodigo_v1.0.txt
51 lines (46 loc) · 1.19 KB
/
codigo_v1.0.txt
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
45
46
47
48
49
50
51
#include <iostream>
#include <string>
#include <cstdlib>
#include <ctime>
using namespace std;
static const char AlphaNumeric[] = "0123456789"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz";
int Lenght = sizeof(AlphaNumeric) - 1;
char RandomStr() {
return AlphaNumeric[rand() % Lenght];
}
int main() {
bool genAgain = true;
while (genAgain = true) {
cout << "Amount of strings to be generated: ";
int strRemaining;
cin >> strRemaining;
cout << "Length of the generated strings: ";
int strLenght;
cin >> strLenght;
system("cls");
srand(time(0));
while (strRemaining > 0) {
// srand(time(0));
for (int m = 0; m < strLenght; m++) {
cout << RandomStr();
}
strRemaining--;
cout << endl << endl;
}
char yesNo;
cout << "Generate more strings? (y/n): ";
cin >> yesNo;
switch (yesNo) {
case 'Y': case 'y':
genAgain = true;
system("cls");
break;
case 'N': case 'n':
genAgain = false;
return 1;
}
}
return 0;
}