c 错哪里?若S1 是S2的substring , return 位置 , 若不是,return -1
#include
#include
using namespace std;
int indexof( const char *s1 , const char * s2)
{
int L1=strlen(s1) , L2=strlen(s2);
if( L1>L2)
return -1;
else if (L1>s1;
cin>>s2;
cout<<indexof(s1,s2);
system("pause");
return 0;
}
int indexof( const char *s1 , const char * s2)
{
int L1=strlen(s1) , L2=strlen(s2);
if( L1>L2)
return -1;
else if (L1<=L2)
{
for ( int i=0 ; i<=L2-L1 ; i ) /* 应该是等号 */
{
if ( s1[0]==s2[ i])
{
char *list = new char [ L1 1];
for ( int j=0 ;j{
list[j] = s2[j i];
}
list[L1]=' ';
if ( strcmp( s1 , list)==0)
return i 1; /* 如果位置从1开始计算,否则从0开始不改 */
}
}
}
return -1; /* 没有匹配 */
}。
答:详情>>
答:这个内容很多阿。 具体你可以去论坛看看: 进入注册之后进入软件区域就可以看到了。详情>>
答:重新驱动一下网卡详情>>