C/C++の宿題を片づけます 49代目
■ このスレッドは過去ログ倉庫に格納されています
0287デフォルトの名無しさん
2005/08/27(土) 06:44:11#include <stdio.h>
#include <stdlib.h>
#define NPLANE 4
int main(int argc, char *argv[])
{
static unsigned long count[NPLANE][256] = {0};
int c, plane, i;
FILE *fp = fopen(argv[1], "rb"); /* エラーチェックしてない */
for (plane = 0; (c = fgetc(fp)) != EOF; plane = (plane + 1) % NPLANE)
count[plane][c]++;
for (i = 0; i < 256; i++) {
printf("%d,%lu", i, count[0][i]);
for (plane = 1; plane < NPLANE; plane++)
printf(",%lu", count[plane][i]);
printf("\n");
}
return 0;
}
■ このスレッドは過去ログ倉庫に格納されています