- 55 名前:36 mailto:sage [2007/07/16(月) 18:18:48 ]
- すいませんがどなたか使い方教えてください・・・
750 :デフォルトの名無しさん [sage] :2007/07/12(木) 13:00:15 >>748 ショボイですが 暗号 #include <stdio.h> #include <ctype.h> static char alpha[53] = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; static char table[53] = "zNFeYMljvJXKicfrGyDEOwQpHkCLbxhqRAPsnouVTaWIZdUmBStg"; int getindex(char *str, int ch){ int i; for(i = 0; i < 52 && str[i] != ch; i++) ; return i; } int main(int argc, char *argv[]){ FILE *fpin, *fpout; int ch, op; if(argc < 3 || (fpin = fopen(argv[1], "r")) == NULL || (fpout = fopen(argv[2], "w")) == NULL) exit(1); while((ch = fgetc(fpin)) != EOF) if(isalpha(ch)) fputc(table[getindex(alpha, ch)], fpout); else fputc(ch, fpout); fclose(fpin), fclose(fpout); return 0; }
|

|