Is is necessary to include computer code into thesis?
I had the exact same situation with the completion of my thesis.

The first thing I did was to consult with my supervisor - seek your supervisor's advice - particularly if they have supervised someone doing similar before.

What I ended up doing (in my successfully completed thesis) was to include pseudocode and explanations of that pseudocode in the context of the experimental data (and with any theoretical background also). I was advised and did put the .exe in a CD in the back of the thesis.

Additionally, I published papers about the program and made reference to them in the thesis.

Another option is to upload the code in an online code repository (e.g. GitHub), only if there is no issues with sharing the code.

(Note: where I am, research theses are peer-reviewed for assessment)