Possible Duplicate:
Calling functions from main() in c++
what are some guidlines to changing int main to call other functions in your code I was told not to use int main2(), int main3() and so on also how do I declare them so that the compiler calls them and recognizes them would it be
#include <iostream>
int main()
int main 2()
using namespace std;
int main()
code here ..... 1st function
int main2()
code here .... 2nd function
or would it be
#include <iostream>
int anothername()
int seconddifferentname()
using namespace std;
int anothername()
code here ..... 1st function
int seconddifferentname()
code here .... 2nd function
You create new functions and call them from main:
There’s nothing technically wrong with having
main1ormain2methods, but there’s only one entry point of a valid C++ program, and that’smain.