Why Java could have many Main that you can decide which java file you want to run, but for C++ you are only one Main?
<p>Every time I write C++, I need put different code in to main, is there any way make it simple, like a1.cpp has main, a2.cpp has another main,
like in a1.cpp</p>

<pre><code>int main() {
    printf("a1");
}
</code></pre>

<p>and in a2.cpp</p>

<pre><code>int main() {
    printf("a2");
}
</code></pre>

<p>when you run a1.cpp you get <code>a1</code> printout, when you run <code>a2</code>, you get string <code>a2</code>,
how can i do it?</p>
