-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmainWin64.cpp
More file actions
85 lines (79 loc) · 1.92 KB
/
mainWin64.cpp
File metadata and controls
85 lines (79 loc) · 1.92 KB
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#include <iostream>
#include <string>
#include <cstdlib>
#include <ctime>
using namespace std;
static const char AlphaNumericSimple[] = "0123456789"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz";
int LenghtSimple = sizeof(AlphaNumericSimple) - 1;
static const char AlphaNumericComplex[] = "0123456789"
"ABCDEFGHIJKLMNOPQRSTUVWXYZ"
"abcdefghijklmnopqrstuvwxyz"
"!#$";
int LenghtComplex = sizeof(AlphaNumericComplex) - 1;
char RandomSimple() {
return AlphaNumericSimple[rand() % LenghtSimple];
}
char RandomComplex() {
return AlphaNumericComplex[rand() % LenghtComplex];
}
int main() {
start:
char simpleComplexStr;
cout << "Generate simple or complex strings? (s/c): ";
cin >> simpleComplexStr;
cout << "Amount of strings to be generated: ";
int strRemaining;
cin >> strRemaining;
cout << "Lenght of the generated strings: ";
int strLenght;
cin >> strLenght;
srand(time(0));
switch (simpleComplexStr)
{
case 's':
system("cls");
while (strRemaining > 0)
{
for (int m = 0; m < strLenght; m++) {
cout << RandomSimple();
}
strRemaining--;
cout << endl << endl;
};
break;
case 'c':
system("cls");
while (strRemaining > 0)
{
for (int m = 0; m < strLenght; m++) {
cout << RandomComplex();
}
strRemaining--;
cout << endl << endl;
};
break;
default:
system("cls");
cin.clear();
cout << "Wrong input! Try again! \n";
goto start;
break;
}
cout << "Generate more strings? (y/n): ";
char yesNo;
cin >> yesNo;
bool genAgain;
switch (yesNo)
{
case 'y': case 'Y': case 's': case 'S':
genAgain = true;
system("cls");
goto start;
break;
default:
return 1;
}
return 0;
}