C/C++の宿題を片付けます 103代目 at TECH
[2ch|▼Menu]
55:デフォルトの名無しさん
08/01/15 16:56:37
//>>52
#include <stdio.h>
#include <ctype.h>
#include <string.h>

void crypt(char * foo)
{
static char const inputLetters[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
static char const outputLetters[] = "NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm";
for (int ic = 0; foo[ic] != '\0'; ++ic) {
int ch = foo[ic];
char * pos = strchr(inputLetters, ch);
if (pos != NULL) {
foo[ic] = outputLetters[pos - inputLetters];
}
}
}

int main()
{
char buf[81];
for (int ic = 0; ic < 10 && fgets(buf, sizeof(buf), stdin) != NULL; ++ic) {
crypt(buf);
fputs(buf, stdout);
}
return 0;
}


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

4959日前に更新/357 KB
担当:undef