I want to do a text search, like the ones I do in MySQL. Ex: LIKE "9% 4"
I tried to implement a find_if()
, but without success.
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main()
{
int n;
string a;
cin >> n;
while(n--)
{
cin >> a;
if(a.find("35") != string::npos)
cout << "-" << endl;
else if(a.find("190") != string::npos)
cout << "?" << endl;
else if(find_if(a.begin(), a.end(), "9*4") != a.end())
cout << "*" << endl;
else
cout << "+" << endl;
}
return 0;
}
I can scroll through the whole string and search for "9 * 4" can be any number, but I think you should have a smarter way to do that.