C/C++の宿題を片付けます 54代目
■ このスレッドは過去ログ倉庫に格納されています
0424デフォルトの名無しさん
2005/12/05(月) 10:08:46#include <stdio.h>
#include <string.h>
int main(void)
{
char sent[100] = {"This is the test program"};
char buf[256], str [256];
char* p = sent;
char* q = str;
printf("検索ワード入力 :");
fflush(stdout);
fgets(buf, sizeof(buf), stdin);
sscanf(buf, "%s", str);
while ((p = strchr(p, *q)) != NULL)
{
while (*++q != '\0')
{
if (*++p != *q)
{
break;
}
}
if (*q == '\0')
{
printf("%s は見つかりました。", str);
break;
}
q = str;
}
return 0;
}
■ このスレッドは過去ログ倉庫に格納されています