How can I convert string to code at run time

It is possible to use TCC ( http://bellard.org/tcc/ ). It allows to compile and run code natively at runtime. Another approach is to use an interpreter, there are plenty out there (LUA, Python etc, see list wiki).


One does not simply interpret C/C++ code... AFAIK you just can't.
(except if you compile another binary and run it from cmd line maybe...)

Note: You can write

fly = (x > 10);

instead of

if(x > 10){
    fly = true;
}else{
    fly = false;
}

No. C++ is a compiled language and has no eval-function or the-like. You may want to include a scripting engine into your program, like Lua