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
|
int get_int(char prompt[], int min, int max);
12 int validate_password(char pwd[], int min_uppers,
13 int min_lowers, int min_length);
14 int main()
15 {
16 char password[20];
17 int min_uppers, min_lowers, min_length;
18
19 min_uppers = get_int("How many upper case characters are
20 required? ", 1, 3);
21 min_lowers = get_int("How many lower case characters are
22 required? ", 1, 3);
23 min_length = get_int("What is minimum length (6-8)? ", 6, 8);
24
25 cout << endl << endl;
26
27 cout << "OK\n";
28 cout <<"Enter your password: ";
29 cin.getline(password,20);
30
int get_int(char prompt[], int min, int max)
64 {
65 int value;
66 value = min;
67 value = max;
68
69 if(value >= 1 && value <= 3)
70 return value;
71 else
72 value = get_int(": NUMBER MUST BE WITHIN RANGE\n"
73
74 }
| |