mahlerfive 23 Junior Poster in Training

You shouldn't ever be returning the operators though, only the result of operations or the number value in the node.

In the first branch, after you apply the operator to the two children, you should get back a double then return that.

In the second branch you should be returning the value (which is a double).

efus commented: thank you +1
mahlerfive 23 Junior Poster in Training

A lot of important questions here, so I will try and answer them the best I can.

First, the main difference between passing by value and passing by reference.. When we pass by value, the receiving function obtains a copy of the variable. If the function then alters the contents of that variable, these changes are not seen outside the function. This means the function has it's own local copy of the variable which does not affect anything outside of it.
When we pass by reference, we are passing a pointer or reference to an object, not a copy. This means when the function alters the object being referenced, the object is also changed outside of this function. Here is a quick example:

Passing by Value:

#include <iostream>
using namespace std;

int main() {
   int x = 5;
   cout << "In main before we call the function, x = " << x << endl; // result is 5
   MyFunction( x );
   cout << "In main after we call the function, x = " << x << endl; // result is still 5, even though we changed x inside MyFunction
   return 0;
}

void MyFunction( int x ) {
   cout << "In MyFunction x = " << x << endl; // result is 5 
   x = 10;
   cout << "In MyFunction x = " << x << endl; // result is now 10
}

If this does not fully make sense, then you should read about "scope" …

OmniX commented: Nice detailed explination, thankyou! +1
mahlerfive 23 Junior Poster in Training

This is a prime example of how I see some students graduate in computer science and don't understand basic object oriented programming concepts. You need to figure this out yourself. Of course if you try and have most of it worked out but are hung up on something very specific and need help then by all means, ask questions and learn - but just asking for us to answer the entire question for you means you learn nothing and pollute the computer science world with people who can't code and can't understand basic programming principles.

Salem commented: Absolutely! Well said. +20
mahlerfive 23 Junior Poster in Training

To be a bit clearer, you can use the stringstream class like so:

#include <iostream>
#include <sstream>
using namespace std;

int main() {
    stringstream ss; // our stringstream object
    int a = 1, b = 2, c = 3;
    
    ss << a << b << c; // we insert a b and c into the stringstream
    cout << ss.str(); // call str() to get the string out
    
    system("pause");
    return 0;
}

For more info on stringstream check out: http://www.cplusplus.com/reference/iostream/stringstream/

OmniX commented: Perfect example, thankyou. +1