hey guys ... It is my first time to practice with binary tree thing. I am not sure how my constructor is supposed to be .. I have written this code can anyone give me any hint for my constructor ?
Code:#include <iostream> using namespace std; class BinaryTreeImplementation{ private: public: int key; BinaryTreeImplementation* root; BinaryTreeImplementation* leftLeaf; BinaryTreeImplementation* rightLeaf; BinaryTreeImplementation{ leftLeaf = NULL; rightLeaf = NULL; } void addNewNode(); }; void BinaryTreeImplementation::addNewNode(){ BinaryTreeImplementation* root = newNode(); root->left = newNode(); root->right = newNode(); root->left = leftLeaf; root->right= rightLeaf; } int main(){ int num=0; while(1){ cout << "(1)Enter a newe calculation string" << endl; cout << "(2)Print the current tree in infix notation" << endl; cout << "(3)Prting the current tree in prefix notation" << endl; cout << "(4)Pring the current tree in postfix notation" << endl; cout << "(5)Caculate the result of the current tree" << endl; cout << "(6)Exit the program"<<endl; cin >> num; if(num=1){ } if(num=2){ } if(num=3){ } if(num=4){ } if(num=5){ } if(num=6){ break; } if( num < 1 || num > 6){ cout << " Error! Please choose one of the following options" << endl; } }