64,639
社区成员
发帖
与我相关
我的任务
分享
#include <iostream>
using namespace std;
const char* strstr1(const char *,const char *);
main()
{
char *str={"12345554555123"};
char zistr[10]={"0"};
cin>>zistr;
char *str2=&str[3];
cout << strstr1(str,zistr) <<endl;
}
const char *strstr1(const char *str,const char *zistr)
{
for(int i=0;str[i]!='\0';i++)
{
int j=0;
while(str[i+j]==zistr[j] || zistr[j]=='\0')
{
if (zistr[j]=='\0')
{
return &str[i];
}
++j;
}
}
return NULL;
}
cout << NULL<<endl;