Embedding shell scripts in another language?

Is it possible to embed shell scripts into a higher-level programming language, for example, C++?
How would one go about doing that? For example, do you just place the script somewhere in the C++ code and the compiler is able to understand the script and the C++ code too?