任务描述
本关任务:输入两个字符串str1和str2,每个字符串是一行,查找str2在str1里首次出现的位置。
编程要求
在右侧编辑器补充代码,根据读入的两个字符串,实现查找功能。如果str2在str1中不存在,则输出-1。
注意:(1)每一行不超过160个字符,可以包含任意字符;(2)不使用字符串比较的库函数。
#include <iostream>
#include<cstring>
using namespace std;
int main()
{
bool
任务描述
本关任务:输入两个字符串str1和str2,每个字符串是一行,查找str2在str1里首次出现的位置。
编程要求
在右侧编辑器补充代码,根据读入的两个字符串,实现查找功能。如果str2在str1中不存在,则输出-1。
注意:(1)每一行不超过160个字符,可以包含任意字符;(2)不使用字符串比较的库函数。
#include <iostream>
#include<cstring>
using namespace std;
int main()
{
bool