There are two types of programs: interpreted and native binaries. Interpreted programs need some other program (interpreter) to run and work. Native binaries don’t.
Java-programs are always interpreted programs (seen that cute coffee cup on your computer asking you to update?). C, C++ etc. are always native binaries. How this affects you? Interpreted programs are mostly slower than native binaries but with them you have to just once download the interpreter-program when with native binaries you have to always make sure it gets along with your operating system and processor. That’s why many programs have different versions or they ask whether you are using Windows 64bit or 32bit and so on.
Okay, but what are you going to do with TEXT-file that has a computer program inside it? If the file really is just .txt, you can hardly do anything unless you know what language the file is and change the file type into it.
But if it is .py (in case of Python) or .jar / .class (Java), you need interpreter because these are interpreted programs. The interpreters can be found on Internet (in these cases from Oracle’s website or Python.org). After you have this interpreter on your computer, you can just double-click the .py/.jar file and your computer will run it for you (probably Windows only, may work on Linux too, depending on your distro, configurations and the phase of the Moon).
If the file is .c / .cc / .cpp (or something else) you need to compile the code to a binary. So, you’ll need compiler. Use Google to get one. You just have to get the right one for your operating system and the programming language you're using. What to do next depends on the compiler, so read its instructions. I’m quite sure that Internet is full of instructions but send me email if I’m wrong, and I can try to create instructions.
After you have done the compiling, you can do the double-clicking (or use command row or whatever...).
In conclusion, there is hardly any way to do easy access program that works for all. You either need interpreter or you have to compile it for specific cases.
Note: 64bit Windows can most of the time run 32bit Windows programs but not the other way round. So, creating program for 32bit Windows, will make it work most of the time for like 99% of Windows’s.