rendered paste body#include <vector>
#include <iostream>
#include <cstdlib>
using namespace std;
void print(vector <string> v) {
if (v.empty()) {
cout << "found no matches" << endl;
}
else {
for (int i =0; i < v.size() ; i++) {
cout << v[i] << endl;
}
}
}
int match (string a, string b, vector <string> m) {
cout << "reached match function" << endl;
for (int y = 0; y < a.size(); y++) {
cout << y << endl;
if ((a.at(y) != b.at(y)) && (a.at(y) != '?')) {
cout << "letters not match" << endl;
return -1;
}
}
m.push_back(b);
return 0;
}
int searchFull(string list[], vector <string> v, string target, int m) {
int i = 0;
int j;
while (i < m) {
if (list[i].size() == target.size()) {
cout << "size match" << endl;
j = match(target, list[i], v);
}
i++;
}
}
int main() {
vector <string> myvector;
string m[5] = { "test", "test", "test", "test", "test" };
searchFull(m, myvector, "test", 5);
print(myvector);
system("pause");
return 0;
}