Can I write a program in C or in C++ with two main functions?
No, a program can have just 1 entry point(which is main()). In fact, more generally, you can only have one function of a given name in C.
main()