I just wrote a simple C++ program. But now I want to share it with a friend and GMail doesn't allow me to use it and putting it on a web domain doens't work either. How do you share a simple program (compiled)?

I use Dropbox. I can put it in some .zip file if need be.

BUT if the friend has like most of us an anti-virus installed even that may block it.

A free Google account includes 5GB of space, that you can use through Google Drive. It will even integrate with a Windows Desktop.

Compress it to file.zip using a password, rename it to "file", attache it and tell your friend to rename it to file.zip and give him the password.

BobFx has the right idea. Technically an unencrypted zip will work, but some virus scanners and security programs unzip attachments to see if there is an executable lurking inside, so password-protected is the way to go. Just make sure the resulting zip file doesn't have the character phrase ".exe" anywhere in the filename and you should be fine. Renaming the executable itself won't work because any reputable security program is ignoring the filename and checking the digitial signatures inside the file to determine what type of file it really is, but a lot of screening programs will just as a matter of form toss anything that flashes anything that looks like an executable extension anywhere in the filename.