Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdio.h>
- #include <string>
- #include <cstring>
- #include <iostream>
- #include <cstdlib>
- using namespace std;
- int main(){ // ALGORYTM NAIWNY- WYSZUKIWANIE WZORCA W TEKSCIE
- int i = 0;
- char wzorzec[] = {'a', 'l', 'a'};
- char tekst[] {'m', 'a', 'l', 'a', 'x'};
- int m = sizeof(wzorzec);
- int n = sizeof(tekst);
- cout << "m = " << m << endl << "n = " << n << "\n--------------\n";
- for(i = 0; i<((n-m)+1); i++){
- int j = 0;
- while( wzorzec[j] == tekst[i+j]){
- cout << wzorzec[j] << endl;
- j++;
- }
- }
- system ("PAUSE");
- }
Advertisement
Add Comment
Please, Sign In to add comment