-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNimaMain.cpp
More file actions
executable file
·48 lines (34 loc) · 1.18 KB
/
Copy pathNimaMain.cpp
File metadata and controls
executable file
·48 lines (34 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include <iostream>
#include <vector>
//#include <algorithm>
#include "MooreSearch.h"
#include <string>
using namespace std;
//Note: only cstrings is working right now. c++ strings is not working yet.
//To get the result vector use getResult.
//To hide the couts in the class, edit the bool statement in the top of the h file
//to change max size, change that at the top of the header
int main() {
string textstring = "Yo this is just a test it is not done yet just";
string keystring = "is";
const char * text = textstring.c_str();
const char * key = keystring.c_str();
int n = textstring.size();//size of text
int m = keystring.size();//size of pattern
BoyerMoore bm(key, m);
//BoyerMoore bm(keystring); //string version (not working)
bm.search(text, n);
//bm.search(textstring); //string version
bm.searchstarter(text, n);
cout<< bm.searchstep();
cout<<bm.searchstep();
cout<<bm.searchstep();
cout << bm.searchstep();
cout << bm.searchstep();
cout << bm.searchstep();
cout << bm.searchstep();
cout << bm.searchstep();
cout << bm.searchstep();
vector<int> resultfromsearch = bm.getResult(); //this gets the result
return 0;
}