-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathS17.cpp
47 lines (42 loc) · 1.02 KB
/
S17.cpp
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
#include <iostream>
#include <string>
using namespace std;
string ReadPassword()
{
string Password;
cout << "Enter Password System " << endl;
cin >> Password;
return Password;
}
bool GuessPassword(string OriginalPassword)
{
string Word = "";
int count = 0;
for (char i = 'A'; i <= 'Z'; i++)
{
for (char b = 'A'; b <= 'Z'; b++)
{
for (char c = 'A'; c <= 'Z'; c++)
{
Word += i;
Word += b;
Word += c;
count++;
cout << "Trial [" << count << "] : " << Word << endl;
if (OriginalPassword == Word)
{
cout << "\n Password is " << Word << endl;
cout << " Found After " << count << " Trial(s)" << endl;
return true;
}
Word = "";
}
}
}
return false;
}
int main(int argc, char const *argv[])
{
GuessPassword(ReadPassword());
return 0;
}