//包含文件:string.h
//函数名: strstr
//函数原型:extern char *strstr(char *str1, char *str2);
//功能:从字符串str1中查找是否有字符串str2,如果有,从str1中的str2位置起,返回str1中str2起始位置的指针,如果没有,返回null。
//返回值:返回该位置的指针,如找不到,返回空指针。
#include<iostream>
#include<string.h>
#include<stdio.h>
#include<ctype.h>
#include<algorithm>
#include<stack>
#include<queue>
#include<set>
#include<math.h>
#include<vector>8
#include<map>
#include<deque>
#include<list>
using namespace std;
int main()
{
char a[999];
char b[999];
while(scanf("%s%s",a,b)!=EOF)
{
char* c=strstr(a,b);
if(c==NULL)
cout<<"isnull!"<<endl;
else
cout<<c<<endl;
}
return 0;
}
strstr函数的用法
最新推荐文章于 2024-08-04 00:28:03 发布