C/C++の宿題を片付けます 103代目at TECH
C/C++の宿題を片付けます 103代目 - 暇つぶし2ch394:デフォルトの名無しさん
08/01/21 18:36:29
>>391
#include <stdio.h>
#include <string.h>
int main()
{
int i = 0, max = -1, max_i = -1;
char buf[200], *p, *tmp[100];

printf("単語を入力してください:");
fgets(buf, sizeof(buf), stdin);
sscanf(buf, "%s", buf);
for (p = strtok(buf, ","); p != NULL; i++)
{
int len = strlen(p);
if (max < len)
{
max = len;
max_i = i;
}
tmp[i] = p;
p = strtok(NULL, ",");
}
printf("最長文字列は%s", tmp[max_i]);

return 0;
}


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