Say you have a class called example:

class example
{
int one;
int two;
};

and you use this to get numbers from the user:

example number;

cout<<"enter numbers"<<endl;
cin>>number.one>>number.two;

and then you call one function to manipulate the numbers and another to do some more manipulation. How do you get those numbers from one function to the other?

function1(number.one, number.two);
function2(number.one, number.two);

Here is one way it could be done.

class example
{
public:
   int one;
   int two;
};

int function1(int one, int two)
{
   return one * two;
}

int function2(int one, int two)
{
    return one + two;
}

int main()
{
    example number;

    cout<<"enter numbers"<<endl;
    cin>>number.one>>number.two;   
    cout << function1( function2(number.one, number.two), 3);
}

is there a way to not put in integer 3? And just get number.one and number.two into the next function?

You can do it any way you want. You don't even have to nest the two functions like I showed you.

int n = function2(number.one, number.two);
cout << function1( n, number.two);

There are lots of ways to do what you described. Let your imagenation be your guide and try them out with your compiler to see what happens. Practice makes perfect :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.