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.
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.