How to check code written by user in c++ language

i am making a game to teach programming Its something like there would be a computer screen in the Game and user will write the c++ code if it compiles successfully then user can go to next level! CAN SOMEBODY PLEASE GUIDE ME HOW CAN WE LINK COMPILER IN GAME! Or any other way to do this task!

I think your best bet would be to create your own barebones interpreter or find a project someone made with an appropriate license… I don’t think any commercial IDE’s would allow the kind of use you’re suggesting.