Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main()
- {
- string password;
- string generatedPass;
- cout << "gimme tha password dawg" << endl;
- cin >> password;
- char digitArray[]={'a'-1,'a','a','a','a','a','a','a','a','a'};
- while( password.compare(generatedPass) != 0 ){
- digitArray[0]++;
- for(int x=0;x<password.length();x++){
- if (digitArray[x] == 'z'+1)
- {
- digitArray[x] = 'a';
- digitArray[x + 1]++;
- }
- }
- // creating the string with those digits
- generatedPass=digitArray[password.length()-1]; // i set the first one here
- for(int i=password.length()-2 ; i>=0 ; i-- )
- generatedPass+= digitArray[i]; // now i add other digits to next to first digit
- cout << generatedPass << endl; // i put it to test how it looks
- }
- cout << generatedPass << endl; // gives the result
- return 0;
- }
Add Comment
Please, Sign In to add comment