Code:
#include <iostream>
#include <string>
#include <windows.h>
#include <stdio.h>
#include <time.h>
using namespace std;
int main() {
srand ( time ( NULL ) );
unsigned short int counterN; // counter for Number of passWords
unsigned short int NumberOfPassWord; // Number of passwords
unsigned short int PassWordLong; // How Long The PassWord
char Alphabet [74] = {'a','b','c','d','e','f','g','h','i','j','k','l',
'm','n','o','p','q','r','s','t','u','v','w','x','y','z','A',
'B','C','D','E','F','G','H','I','J','K','L','M','N','O','P',
'Q','R','S','T','U','V','W','X','Y','Z','0','1','2','3','4',
'5','6','7','8','9','!','@','#','$','%','^','&','*','(',')',
'?','~' };
cout << "Enter length of password\n>";
cin >> PassWordLong;
cout << "Enter number of passwords\n>";
cin >> NumberOfPassWord;
for ( counterN = 1; counterN <= NumberOfPassWord; counterN++ ) {
for ( ; PassWordLong > 0; PassWordLong-- )
cout << Alphabet [ rand() % 74 ];
cout << endl;
}
system("pause");
return(0);
}
Why doesn't this work!!!!!!
But this dose....
Code:
#include <iostream>
#include <string>
#include <windows.h>
#include <stdio.h>
#include <time.h>
using namespace std;
void Long (int passwordlong);
int main() {
srand ( time ( NULL ) );
unsigned short int counterN; // counter for Number of passWords
unsigned short int NumberOfPassWord; // Number of passwords
unsigned short int PassWordLong; // How Long The PassWord
cout << "Enter length of password\n>";
cin >> PassWordLong;
cout << "Enter number of passwords\n>";
cin >> NumberOfPassWord;
for ( counterN = 1; counterN <= NumberOfPassWord; counterN++ ) {
Long( PassWordLong);
cout << endl;
}
system("pause");
return(0);
}
void Long ( int PassWordLong ) {
char Alphabet [74] = {'a','b','c','d','e','f','g','h','i','j','k','l',
'm','n','o','p','q','r','s','t','u','v','w','x','y','z','A',
'B','C','D','E','F','G','H','I','J','K','L','M','N','O','P',
'Q','R','S','T','U','V','W','X','Y','Z','0','1','2','3','4',
'5','6','7','8','9','!','@','#','$','%','^','&','*','(',')',
'?','~' };
for ( ; PassWordLong > 0; PassWordLong-- )
cout << Alphabet [ rand() % 74 ];
}
Can someone help me out..... I got it to work but that I don't understand why the first one doesn't work its mind boggling......