Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- void findtext(string input, string wzor){
- int inputDl = input.size();
- int wzorDl = wzor.size();
- bool ok = true;
- for(int i=0; i<inputDl; i++){
- ok = true;
- for(int j=0; j<wzorDl; j++){
- // cout<<i<<" "<<j<<" [] " <<ok<<endl;
- // cout<<input[j+i]<<endl;
- // cout<<wzor[j]<<endl;
- if(input[j+i]!=wzor[j]){
- ok = false;
- break;
- }
- }
- if(ok){
- cout<<"ZNALEZIONO WZORZEC NA POZYCJI: "<<i<<endl;
- break;
- }
- }
- if(!ok){
- cout<<"NIE ZNALEZIONO WZORCA"<<endl;
- }
- }
- int main()
- {
- string input = "karykatura";
- string wzor = "ryk";
- findtext(input, wzor);
- return 0;
- }
Add Comment
Please, Sign In to add comment