#include <stdio.h>
#include <stdlib.h>
void main()
{
FILE *pt;
int a,b,cnum,gnum,t;
printf("Characters of password: ");
scanf("%d",&cnum);
printf("How many passwords: ");
scanf("%d",&gnum);
pt = fopen("logs.txt","w");
for(a=0;a<gnum;a++)
{
for(b=0;b<cnum;b++)
{
fprintf(pt,"%c",charset(random(62)));
}
fprintf(pt,"\n");
}
printf("\nAll passwords are in \"logs.txt\"");
printf("\nPress any key to continue ...");
getch();
}
int charset(n)
{
char ch;
switch(n){
這裡
其實可以用ASCII的轉換
1.你....0~9直接ch==n即可
2.10~35轉a~z用ASCII即可
3.同上..........
}
return ch;
}
C++我不太熟
只能做到這邊而已...........