Advertisement
Guest User

Untitled

a guest
Sep 25th, 2017
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. void mathProcessor::processExpression (binaryTreeNode<string> *p){
  2. binaryTreeNode<string> *newNode;
  3. string temp;
  4. temp="";
  5. if(expression[position] == '('){
  6. newNode = new binaryTreeNode<string>;
  7. newNode->llink = NULL;
  8. newNode->rlink = NULL;
  9. p->llink = newNode;
  10. position ++;
  11. processExpression(p->llink);
  12. }
  13. if(isDigit(expression[position])){
  14. while(isDigit(expression[position])){
  15. temp += expression[position];
  16. position ++;
  17. }
  18. p->info = temp;
  19. temp = "";
  20. return;
  21. }
  22. if(isOperator(expression[position])){
  23. temp = expression[position];
  24. p->info = temp;
  25. binaryTreeNode<string> *newNode;
  26. temp = "";
  27. newNode->llink = NULL;
  28. newNode->rlink = NULL;
  29. position ++;
  30. processExpression(p->rlink);
  31. }
  32. if(expression[position] == ')'){
  33. position++;
  34. return;
  35. }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement