关于字符串插入的问题 知道的请回答 谢谢
int cmp(char *p,char *q)
{
int i,j,k,size,*pos=new int[strlen(p)];
bool nomat=true;
/*先找出首字符的匹配位置集*/
j=0;
for(i=0;p[i];i++)
{
if(p[i]==q[0])
{
nomat=false;
pos[j++]=i;
}
}
if(nomat)
return -1;
else if(strlen(q)==1)
return pos[0];
else
{
/*匹配剩余项*/
size=j;
j=0;
while(j全部
int cmp(char *p,char *q)
{
int i,j,k,size,*pos=new int[strlen(p)];
bool nomat=true;
/*先找出首字符的匹配位置集*/
j=0;
for(i=0;p[i];i++)
{
if(p[i]==q[0])
{
nomat=false;
pos[j++]=i;
}
}
if(nomat)
return -1;
else if(strlen(q)==1)
return pos[0];
else
{
/*匹配剩余项*/
size=j;
j=0;
while(j 收起