Compiling a code in a cooked game

My thesis in school involves teaching some very basic C programming language, i know it needs visual studio to compile its C++ codes so me and my partner’s idea is to off load a text file in the game then using a command launch a c compiler such as Mingw. My question is how do I get that output? do I have to put it in a text file and load it in the game or attach the c compiler to the game and it receives its output or is there a way to add a code in the game that can access the engines compile and build abilities as an ingame feature so we dont have to use an external compiler?