使用 random() 製造亂數
再轉成char存入目的檔中
有點小白的程式
希望有大大能教我如何使用ASCII碼
這樣就可以輕鬆的把特殊符號一起加進密碼簿裡... Thanks!
#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){
case 0:
ch=Ɔ'
break;
case 1:
ch=Ƈ'
break;
case 2:
ch=ƈ'
break;
case 3:
ch=Ɖ'
break;
case 4:
ch=Ɗ'
break;
case 5:
ch=Ƌ'
break;
case 6:
ch=ƌ'
break;
case 7:
ch=ƍ'
break;
case 8:
ch=Ǝ'
break;
ca ..
訪客只能看到部份內容,免費 加入會員 或由臉書 Google 可以看到全部內容