C/C++の宿題を片付けます 91代目at TECH
C/C++の宿題を片付けます 91代目 - 暇つぶし2ch430:デフォルトの名無しさん
07/06/28 14:40:31
>>427
#include <stdio.h>
#include <string.h>

void search(char *s1, char *s2)
{
    int i;
    char *p = s1;
    while((p = strstr(p, s2)) != NULL){
        *p++ = '#';
        for(i = 0; i < strlen(s1) - 1; i++)
            *(p + i) = *(p + i + strlen(s2) - 1);
    }
}

int main(void)
{
    char text[1024], word[1024];
    printf("Please input text : ");
    gets(text);
    printf("text = %s\n", text);
    printf("Please input search word : ");
    gets(word);
    search(text, word);
    printf("text = %s\n", text);
    return 0;
}


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