How do I stop the program without exiting the unreal engine editor? (Only in c++)

You can also use RequestEngineExit(TCHAR * Message): https://docs.unrealengine.com/en-US/…t/1/index.html
IIRC, QuitGame(…) just calls RequestEngineExit(…)