You have to compile the code with a C++ compiler.
TDM-GCC MinGW compiler which you can download from this link: https://sourceforge.net/projects/tdm-gcc/
Once you download and install the compiler, you need to open the cmd, navigate to the folder containing the .cpp files using the "cd" command, and then execute these commands:
g++ -o NewFileName TrojanCockroach.cpp
g++ -o NewFileName Infect.cpp
Change "NewFileName" to w/e you want to name each exe file.
The exe files will appear in the same folder.