The solution will depend on your specifications, you are being very vague about how you want to encrypt it.
If all you want to do is make it hard for somebody to use unless they have a decryption key you can just open the .exe file as you would any other binary file (see binary flag http://www.cplusplus.com/reference/fstream/fstream/open/ ) and load its data into variables, manipulate it in some hard to reverse way, then save it back to the file. Of course this means that the file will no longer run as an executable unless you decrypt it.
So, assuming you have a function that can take a string of numbers and encrypt them this code should work:
using namespace std;
vector<int> encrypt(vector<int> in)
//here you encrypt the 'in' vector and return it
while (!file.eof())//load the whole file into data
for (int i=0;i<encryptedData.size(); ++i)
Of course you should also have decryption functionality or all you will be doing is corrupting executables. Hope this helps.