Code that runs code that is entered

Is it possible to write a code that when you type into it a piece of code (e.g. cout << "Hi!" << endl;) it would run that code. I have wondered if polymorphism will help, but I have no idea. I want to learn what to do instead of just being given I piece of code without explanation. If anyone could even direct me to anything that could help, I would be very grateful.
Yes, that's what interpreters do.

Interpreting C++ is a tricky proposition because the language is so huge, but if you just want to interpret any language, there's Lua. https://www.lua.org/
Some languages, such as C#, because they require a runtime environment that includes a compiler, by default support compiling and executing user input.
closed account (48bpfSEw)
did you mean:
https://solarianprogrammer.com/2012/08/14/cling-cpp-11-interpreter/

This was I'm looking for some hours ago! ^^
Topic archived. No new replies allowed.