鱼C论坛

 找回密码
 立即注册
查看: 4500|回复: 11

这个帖子不算,别看了,我学学发帖。

[复制链接]
发表于 2015-11-17 19:13:11 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
#include<stdio.h>
#include<stdlib.h>

int index( char str1[], char str2[], int pos )
——{                                                                        //此处提醒。——conflicting types for built-in fuction 'index'.
    int j=1;
    int i=pos;

    while( i<=str1[0] || j<=str2[0] )
    {
        if( str1[i] == str2[j] )
        {
            i++;
            j++;
        }
        else
        {
            i = i-j+2;
            j = 1;
        }
    }

    if( j > str2[0] )
    {
        return i-str2[0];
    }
    else
    {
        return 0;
    }
}

int main()
{
    int  a, pos=1;
    char str1[20] =" ilovefishc.com";
    char str2[20] =" fishc";

    str1[0] = 14;
    str2[0] = 5;
    a=index( str1, str2, pos );

    printf("The location of the start equal:");
    printf("%d\n",a);

    return 0;
}
我发个看看。:sad
#include<stdio.h>
#include<stdlib.h>

int index( char str1[], char str2[], int pos )
——{                                                                        //此处提醒。——conflicting types for built-in fuction 'index'.
    int j=1;
    int i=pos;

    while( i<=str1[0] || j<=str2[0] )
    {
        if( str1[i] == str2[j] )
        {
            i++;
            j++;
        }
        else
        {
            i = i-j+2;
            j = 1;
        }
    }

    if( j > str2[0] )
    {
        return i-str2[0];
    }
    else
    {
        return 0;
    }
}

int main()
{
    int  a, pos=1;
    char str1[20] =" ilovefishc.com";
    char str2[20] =" fishc";

    str1[0] = 14;
    str2[0] = 5;
    a=index( str1, str2, pos );

    printf("The location of the start equal:");
    printf("%d\n",a);

    return 0;
}
看看这个能发吗?
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2015-11-17 19:21:26 | 显示全部楼层
那我是不是可以删帖了
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2015-11-17 19:34:25 | 显示全部楼层
康小泡 发表于 2015-11-17 19:21
那我是不是可以删帖了

别啊,姐,我正好有个问题,就是上面那个函数,我发了悬赏,帮我看看呗。
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2015-11-17 19:50:42 | 显示全部楼层
浮云骑士 发表于 2015-11-17 19:34
别啊,姐,我正好有个问题,就是上面那个函数,我发了悬赏,帮我看看呗。

哪个函数?
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2015-11-17 21:08:47 | 显示全部楼层

字符串排序中的BF算法,看小甲鱼的视频学的。
http://bbs.fishc.com/thread-66317-1-1.html
(出处: 鱼C论坛)
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2015-11-17 21:11:42 | 显示全部楼层

悬赏互助中的:BF算法那个。字符串排序中的BF算法,看小甲鱼的视频学的。 [url]http://bbs.fishc.com/thread-66317-1-1.html (出处: 鱼C论坛)[/url]这是链接。
大神帮帮忙。
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2015-11-17 21:12:31 | 显示全部楼层

悬赏互助中的:“字符串排序中的BF算法,看小甲鱼的视频学的”。大神 帮忙看看。
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2015-11-17 21:15:58 | 显示全部楼层

我上面就一个函数,有一个提醒,我标出来了,大神看看。
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2015-11-17 21:17:00 | 显示全部楼层
#include<stdio.h>
#include<stdlib.h>

int index( char str1[], char str2[], int pos )
{                                                                  //此处提醒。——conflicting types for built-in fuction 'index'.
    int j=1;
    int i=pos;

    while( i<=str1[0] || j<=str2[0] )
    {
        if( str1[i] == str2[j] )
        {
            i++;
            j++;
        }
        else
        {
            i = i-j+2;
            j = 1;
        }
    }

    if( j > str2[0] )
    {
        return i-str2[0];
    }
    else
    {
        return 0;
    }
}

int main()
{
    int  a, pos=1;
    char str1[20] =" ilovefishc.com";
    char str2[20] =" fishc";

    str1[0] = 14;
    str2[0] = 5;
    a=index( str1, str2, pos );

    printf("The location of the start equal:");
    printf("%d\n",a);

    return 0;
}
帮帮忙了。
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2015-11-24 16:57:34 | 显示全部楼层
感谢分享
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2015-11-30 13:00:39 | 显示全部楼层

就是来顶 支持
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2015-12-1 09:21:36 | 显示全部楼层
我就是来赚个鱼 币
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-10-6 03:38

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表