标题:这是找句子中的字符串 可是就是不对啊 帮帮忙
取消只看楼主
吴小杰
Rank: 3Rank: 3
来 自:。。。。。。
等 级:论坛游侠
帖 子:58
专家分:107
注 册:2011-11-11
结帖率:100%
已结贴  问题点数:20 回复次数:0 
这是找句子中的字符串 可是就是不对啊 帮帮忙
#include<stdio.h>
int main()
{
    int i=0,j=0;
    char sentence[100]=(" Created is a not big  ");
    char word[5]=("not");
     for    (i=0,j=0;i<=2;j++)
        {
        if((sentence[j]==word[i])&&j<100)
            {i++;}
        if(sentence[j]!=word[i]&&j<100)
             {i=0;}
        if(j>=100)
            break;
        }
           if(i==2)
        {printf(" find\n");}
           else
        {printf("not find\n");}

           printf("%d",i);

return 0;
}

搜索更多相关主题的帖子: word 字符串 
2011-11-11 22:21



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-355010-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.464570 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved