Can I write a program in C or in C++ with two main functions?
You can write it, and it'll compile, but it won't link (unless your linker is non-comformant)