alpha got it completely right but seemed unsure. So I'm here to say, yes.
The functions can be prototyped (what I always do) like so:
(for your program they would look like this)
Code:
//include files
#include <iostream.h>
//function prototypes
int one(); //They're just the functions titles copied with
int two(); // semicolons at the end.
int three();
int main() //Now main can go up top which makes sense because
{ //its the first function the program goes to.
int pick;
cout <<"Pick 1,2, or 3: " <<endl;
cin >> pick;
if (pick==1)
{
one();
}
if (pick==2)
{
two();
}
if (pick==3)
{
three();
}
return 0;
}
int one()
{
cout <<"you picked one!" <<endl;
return 0;
}
int two()
{
cout <<"you picked two!" <<endl;
return 0;
}
int three()
{
cout <<"you picked three!" <<endl;
return 0;
}
When you do this you can place the main function at the top of the program. I feel this makes more sense as its the first function the program goes into anyway.
The reason the compiler works this way (main on top or prototypes) is because the compiler needs advanced warning about whats going on in the program before it compiles. It needs to allocate (reserve for future use) memory for function calls, variables and other things. It does this so it doesn't run out of memory part way through and crash your computer (among other reasons). When you prototype the top of your program it gives the compiler a concise list of everything your program is going to need before it compiles.
If I'm off on this anyone feel free to correct me.
It also gives you a quick way to look at all your functions. I like prototyping and would recommend it to new C and C++ coders.
Very good question and welcome to code newbie.