If you want to have gcc/g++ output the final ELF binary that you can redistribute, use the -o switch.
g++ example.cpp -o example
That will compile your example.cpp into the program "example". You can then test it by typing:
in the same folder. Note: you need the ./ to tell Linux to look in the CURRENT directory for the program. Without it, it will look in your PATH, e.g. /bin, /usr/bin, etc.