You can embed the program inside one of the emulator programs.
So a program written for Windows will run on a mac or Linux with no changes however, it must always run inside an emulator that is correct for the operating system it runs under.
QEMU for example will allow me to run DSL Linux in a window under Windows. This is just one of many emulators for different circumstances. Another type of emulator will only run programs such as Wine under Linux.
There is also common libraries such as the QT libraries that allow you to do the windows part once and compile for each operating system as needed.
Lastly, if you write the program so that it conforms to the C++ standard, it can be compiled and run on any computer though you'd need the source code to do so. A Windows program does not conform to the C++ standard as it uses operating system specific libraries and calls.
The last reason is one reason why I learned C and then C++ and even Java. It may only be a command line program and not so fancy, but it will work on Windows or Linux in a console window and I'm sure that it would work on a mac with little or no changes.
I'd worry about writing a program that would be popular enough that the fans would need to have a version for all operating systems. Programs for personal use don't count as these have a very limited fan base.
Shadow Wolf