Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void mathProcessor::processExpression (binaryTreeNode<string> *p){
- binaryTreeNode<string> *newNode;
- string temp;
- temp="";
- if(expression[position] == '('){
- newNode = new binaryTreeNode<string>;
- newNode->llink = NULL;
- newNode->rlink = NULL;
- p->llink = newNode;
- position ++;
- processExpression(p->llink);
- }
- if(isDigit(expression[position])){
- while(isDigit(expression[position])){
- temp += expression[position];
- position ++;
- }
- p->info = temp;
- temp = "";
- return;
- }
- if(isOperator(expression[position])){
- temp = expression[position];
- p->info = temp;
- binaryTreeNode<string> *newNode;
- temp = "";
- newNode->llink = NULL;
- newNode->rlink = NULL;
- position ++;
- processExpression(p->rlink);
- }
- if(expression[position] == ')'){
- position++;
- return;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement