Please take a look at the included code and help me out with a couple of things.

when executed as it stands i must enter a value for "int c" twice to get through the third function and four times to get through the fourth function.

what would the method be to enter the "int c" value once and use it in the following functions.

i suspect it may be in the way i call the functions in the iostream???

//---------------------------------------------------------------------------

#include <vcl.h>

#include <iostream.h>

#pragma hdrstop

//---------------------------------------------------------------------------

#pragma argsused

int main(int argc, char* argv[])

{

int first(int);

int second(int b, int a);

int third(int b, int a);

int fourth(int a,int b);

int a;

int b;

//send this input to other functions

cout<< "Enter a number: ";

cin >>a;

cout<< "a = " <<a<<"\n";

cout << "Enter another number: ";

cin >> b;

cout<< "b = " <<b<<"\n";

//get this back from other functions

cout<< "\nFirst returns a*c= "<< first(a)<<"\n";

cout<< "\nSecond returns a*b= "<< second(a,b)<<"\n";

cout<< "\nThird returns "<< second(a,b)<<"*"<< first(a)<<"= "<<third(b,a)<<"\n";

cout<< "\nFourth returns "<< first(a)<<"*"<< second(a,b)<<"*"<< third(b,a)<<"= "<< fourth (a,b);

getchar();

return 0;

}

//Functions

//simple a times c

int first (int a)

{

int c;

cout<< "\ninput value for C: ";

cin >>c;

cout<< "In first C = " <<c;

return a*c;

}

//simple a times b

int second (int a, int b)

{

return a*b;

}

//first times second

//requires value for "int c"

//to be entered twice???

int third(int b,int a)

{

return (first(a) * second(a,b));

}

//first times second times third

//requires value for "int c" to be entered

//four times???

int fourth(int a, int b)

{

return ((first(a)* second(a,b))*third(b,a));

}

//---------------------------------------------------------------------------

Thanks

itld