Programming > STUDY GUIDE > bet (All)
#include <iostream> #include <stack> #include <sstream> #include <string> #include "BET.h" //using namespace std; // default zero-param constructor BET::BET() { root = new BinaryNode; leaves ... = 0; nodes = 0; } // one-param constructor, where parameter "postfix" is a // string containing a postfix expression. The tree should // be built based on the postfix expression. Tokens in the // postfix expression are separated by space BET::BET(const string postfix) { root = new BinaryNode; buildFromPostfix(postfix); } // copy constructor BET::BET(const BET & rhs) { leaves = rhs.leaves; nodes = rhs.nodes; root = rhs.root; } // destructor BET::~BET() { makeEmpty(root); leaves = nodes = 0; } bool BET::buildFromPostfix(const string postfix) { // Create stack to hold variables stack<BinaryNode *> s; stack<BinaryNode> bet; char token; string temp; int index = 1; bool doubleDigit = false; int opCount = 0, digitCount = 0; //stringstream hexToInt; // iterator through postfix for (int i = 0; i < postfix.size(); ++i) { // grab token at iterations index token = postfix[i]; if ( (token > '0' && token < '9') || (token > 62 && token < 80)) { // check to see if token is an operand [Show More]
Last updated: 1 year ago
Preview 1 out of 5 pages
Instant download
Buy this document to get the full access instantly
Instant Download Access after purchase
Add to cartInstant download
Connected school, study & course
About the document
Uploaded On
Mar 24, 2021
Number of pages
5
Written in
This document has been written for:
Uploaded
Mar 24, 2021
Downloads
0
Views
148
In Browsegrades, a student can earn by offering help to other student. Students can help other students with materials by upploading their notes and earn money.
We're available through e-mail, Twitter, Facebook, and live chat.
FAQ
Questions? Leave a message!
Copyright © Browsegrades · High quality services·