Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as C by paolo ( 15 years ago )
#include <stdio.h>
int Kol_variantov=0;
void func(int n, int k, char mass[], char* Arr, int pos, int kol) {
int z,i,j;
if(n==1) {
for(j=0; j<36; j++) {
*(Arr+pos)=mass[j];
for(z=0; z<kol; z++) {
printf("%c",Arr[z]);
}
printf("n");
Kol_variantov++;
}
}
else {
for(i=k; i<36; i++) {
*(Arr+pos)=mass[i];
pos++;
func(n-1, k, mass, Arr, pos, kol);
pos--;
}
}
}
int main () {
int n, c, j=0, k=0, p=0;
char v, mass[36];
char * Arr;
for(v='a'; v<='z'; v++) {
mass[j]=v;
j++;
}
for(v='0';v<='9'; v++) {
mass[j]=v;
j++;
}
printf("Enter amount of symbols in a password: ");
scanf("%d", &c);
n=c;
do {
Arr=(char *)calloc(c, sizeof(char));
func(c, k, mass, Arr, p, c);
c--;
} while(c>0);
printf("nnTotal: %d possible passwords or summ(36^n), from n=1 to n=%dnn", Kol_variantov, n);
getch();
}
Revise this Paste