|
From: <jar...@ig...> - 2002-12-06 12:32:02
|
On 6 Dec, Dondolo Mpho wrote:
> Hi all,
>
> I am in the process of learning C++. I have been practising, writing my own
> functions and using main() only to call those function. I also use those
> functions to call up other function....
>
> //e.g.: function (1)
HERE you need a so-called forward declaration
just say
void FunctionTwo(); // <=== note the semi-colon here
// at a later point or within a different file
// you define the 'real' function with the SAME
// function header
>
> void FuctionOne(void)
> {
> int Answer
> cout<<"Are you ready...<press 1 for yes and 2 for no> ";
> cin>>Answer;
> if(Answer==1)
> {
> cout<<"\nI am glad that you are";
> }
>
> else
> {
> FuctionTwo();
> }
>
> }
>
> //Here I have my
> //FunctionTwo
>
> Now I find that the compiler flags an
> error msg that FunctionTwo has not been declared. it only works when I take
> FunctionTwo() and put it on top of
> FunctionOne()....i am I doing something
> wrong? The thing is I might decide halfway through my functions That i want
> function x to call function
> y. Now If i have to readjust my
> functions half way through, i will loose track of what I am doing.....Please
> help anybody
>
--
Helmut Jarausch
Lehrstuhl fuer Numerische Mathematik
Aachen University
D 52056 Aachen, Germany
|