C/C++の宿題を片付けます 93代目at TECH
C/C++の宿題を片付けます 93代目 - 暇つぶし2ch55:36
07/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;
}


次ページ
続きを表示
1を表示
最新レス表示
レスジャンプ
類似スレ一覧
スレッドの検索
話題のニュース
おまかせリスト
オプション
しおりを挟む
スレッドに書込
スレッドの一覧
暇つぶし2ch