A) write a function bool isExist (string s1, string s2)
Whether s1 s2 "queue",
B) hint: use the find function of string
C) dealing with input and output of the reference code, isExist is a function of the need to write,
D) test, input and output in the first place in the native copy and paste method tests are available, and then test the following input:
Aaab a, should be the output?
Topic
Bool isExist (string s1, string s2);
Int main ()
{
Strings str1 str2;
While (cin & gt;> Str1 & gt;> Str2)
{
If (isExist (str1, str2))
Cout & lt; <"Yes" & lt;
Cout & lt; <"No" & lt;
return 0;
}
CodePudding user response:
Bool isExist (string s1, string s2){
Int jug.
Jug=s1. The find (s2);
If (jug!=1) return true;
The else return false;
}
Directly use the find function to find the s1 s2 is lazy method
CodePudding user response:
Another idea isBool isExist (string s1, string s2) {
Int m=s1 length ();
Int n=s2. Length ();
If (n==0) return true;
for (int i=0; i
Int t=I;
While (s1==s2 [t] [j] & amp; & J & lt; N) {
j++;
If (s1 [t]! [j]=s2 & amp; & J & lt; N) {
break;
}
}
If (j)==n {
return true;
}
}
return false;
}
CodePudding user response:
The