大家帮我看看这个错误
大家帮我看看有什么错误,编译后出现:
Compiling...
Cpp1.cpp
C:\Documents and Settings\Administrator\桌面\Cpp1.cpp(36) : warning C4715: 'isSub' : not all control paths return a value
Linking...
Cpp1.exe - 0 error(s), 1 warning(s)
原文如下:
# include <iostream.h>
int isSub(char *,char *);
main()
{
char * a="acbdef";
char * b="bde";
//cout<<a<<endl;
//cout<<b<<endl;
//cout<<*(b+2)<<endl;
cout<<isSub(a,b)<<endl;
return 0;
}
int isSub(char *str1,char *str2)
{
int i=0;
int n;
while(*(str1+i)!='0')
{
n=i;
int j=0;
while(*(str2+j)!='0' && *(str1+n)==*(str2+j))
{
j++;
n++;
if(*(str2+j)=='0')
return i;
}
i++;
}
}