C/C++の宿題を片付けます 117代目at TECH
C/C++の宿題を片付けます 117代目 - 暇つぶし2ch606:605
08/11/11 20:54:39
>>604 2問目 main の中身だけ
char c;
int i, j, alpha[26], max = 0;
for(i = 0; i < 26; i++) /* 配列のクリア */
alpha[i] = 0;
c = getchar();
while(c != '\n') {
if (c >= 'a' && c <= 'z') { /* 英小文字の処理 */
alpha[c - 'a'] += 1;
if (alpha[c - 'a'] > max)
max = alpha[c - 'a'];
} else {
if (c >= 'A' && c <= 'Z') { /* 英大文字の処理 */
alpha[c - 'A'] += 1;
if (alpha[c - 'A'] > max)
max = alpha[c - 'A'];
}
}
c = getchar();
}
for(i = 0; i < max; i++) {
for(j = 0; j < 26; j++) { /* 結果出力 */
if (alpha[j] >= max - i)
printf("* ");
else
printf(" ");
}
printf("\n");
}
for(j = 0; j < 26; j++) /* 結果出力 */
printf("%c ", j + 'a');
printf("\n");


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