C/C++の宿題を片付けます 117代目
at TECH
405:デフォルトの名無しさん
08/11/08 04:29:47
>>402
#include <stdio.h>
#include <string.h>
int main()
{
char str[100], needle[50], *p;
int i = 0;
printf("検索対象文字列を入力:");
scanf("%s", str);
printf("検索文字列を入力:");
scanf("%s", needle);
printf("検索対象文字列→%s\n", str);
printf("検索文字列→%s\n", needle);
printf("検索結果\n%s\n", str);
p = str;
while(strstr(p, needle) != NULL){
if(p == strstr(p, needle)){
i++;
printf("*");
} else
printf(" ");
p++;
}
printf("\n%d個発見しました\n", i);
return 0;
}
次ページ続きを表示1を表示最新レス表示スレッドの検索類似スレ一覧話題のニュースおまかせリスト▼オプションを表示暇つぶし2ch
4985日前に更新/337 KB
担当:undef