#include using namespace std; typedef enum DataType {INTEGER, FLOAT, VARIABLE, OPERATION}; class UniData { DataType type; union { int intData; float floatData; char * varData; }; }; template< class Type > class Node { protected: Type data; unsigned int weight; Node * up; Node * left; Node * right; public: Node() { weight = 0; up = NULL; left = NULL; right = NULL; } Node(Type d1, unsigned int w1) { data = d1; weight = w1; up = NULL; left = NULL; right = NULL; } Node * Add(Node * nn) { if (nn->weight < weight) { if (up) return up->Add(nn); else return nn->Add(this); } else { if (left) { if (right) return NULL; else { nn->up = this; right = nn; return right; } } else { nn->up = this; left = nn; return left; } } } void Print() { left->Print(); right->Print(); char str[16]; cout << data.GetAsStr(str); } }; int main() { char input[] = "(a+b)*(c+d)+a*d"; cout << "Hello world!" << endl; return 0; }