online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
#include<iostream> class BST { private: struct TreeNode { int val; TreeNode *left; TreeNode *right; TreeNode(int x) : val(x), left(nullptr), right(nullptr) {} }; TreeNode* root = nullptr; BST::TreeNode* helperInsert(TreeNode* helpRoot, int key); void helperInorder(TreeNode* helpRoot); public: void inorder(); void insert(int key); }; void BST::helperInorder(BST::TreeNode* helpRoot) { if(helpRoot == NULL) std::cout << ""; else { helperInorder(helpRoot->left); std::cout << helpRoot->val << " "; helperInorder(helpRoot->right); } } BST::TreeNode* BST::helperInsert(TreeNode* helpRoot, int key) { if (helpRoot == nullptr) return new TreeNode(key); else if (key < helpRoot->val) helpRoot->left = helperInsert(helpRoot->left, key); else helpRoot->right = helperInsert(helpRoot->right, key); return helpRoot; } void BST::inorder() { helperInorder(this->root); } void BST::insert(int key) { this->root = helperInsert(this->root, key); } int main() { BST myBST; myBST.insert(15); myBST.insert(1); myBST.insert(5); myBST.inorder(); }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue