Last active
August 19, 2019 19:43
-
-
Save morgangallant/6d076640e0fd03d9f1302dfd168b2042 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
// Some test functions to show that implementation is working. | |
void buy_func_usd() { std::cout << "buy usd." << std::endl; } | |
void buy_func_cad() { std::cout << "buy cad." << std::endl; } | |
void sell_func_usd() { std::cout << "sell usd." << std::endl; } | |
void sell_func_cad() { std::cout << "sell cad." << std::endl; } | |
int main() { | |
// Buy Shares | |
Node *buy_usd = new Node{"usd", "states", "united", "us"}; | |
buy_usd->set_action(buy_func_usd); | |
Node *buy_cad = new Node{"cad", "canadian", "canada"}; | |
buy_cad->set_action(buy_func_cad); | |
Node *buy = new Node{"add", "bought", "buy", "purchased"}; | |
buy->add_node(buy_usd); | |
buy->add_node(buy_cad); | |
// Sell Shares | |
Node *sell_usd = new Node{"usd", "states", "united", "us"}; | |
sell_usd->set_action(sell_func_usd); | |
Node *sell_cad = new Node{"cad", "canadian", "canada"}; | |
sell_cad->set_action(sell_func_cad); | |
Node *sell = new Node{"sell", "sold", "rid"}; | |
sell->add_node(sell_usd); | |
sell->add_node(sell_cad); | |
// Root Node | |
Node *root = new Node{}; | |
root->add_node(buy); | |
root->add_node(sell); | |
// Cleanup memory. | |
delete root; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment