To include C++ code (or Python code, etc.) with an arxiv submission, you need to submit your files in a zipped folder, which includes a subfolder named "anc" (for ancillary) containing your code. See this arxiv help page for more details.

To see what this looks like in practice, see one of my papers where I included an ancillary file called "walk.cpp", or this example that is linked from the arxiv help page.