c++ - evaluating a string in a condition -
how work string evaluate numbers coming condition?
string = "(t>=2 && t<5) || (t<1)"; int c = 0; for(int t = 0; t < 10; t++){ if( {string} ) c++; }
if it's qt write like
qscriptengine e; e.globalobject().setproperty("t", 123); bool result = e.evaluate("(t>=2 && t<5) || (t<1)").tobool();
Comments
Post a Comment