gha890826

5/6課輔-字串搜尋

May 13th, 2020 (edited)
788
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.26 KB | None | 0 0
  1. //字串搜尋
  2. #include <iostream>
  3. #include <iostream>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     string s1="this is s1",s2="is";
  9.     int target=s1.find(s2);
  10.     if(target==string::npos)
  11.         cout<<"can't find\n";
  12.     else
  13.         cout<<"first is at "<<target<<endl;
  14.     return 0;
  15. }
Add Comment
Please, Sign In to add comment