I wrote this as part of an assignment that I turned in, problem is I could not get some of the functions to work. I do have the add working and was able to get output in the add function, just not in the search or inorder. I now have a test in a couple of weeks and feel if I know what I did wrong on this one then I can avoid the same mistakes in the test. So any help in understanding what I'm doing wrong with this would be greatly appreciated.
//Main file
usingnamespace std;
#include <iostream>
#include <sstream>
#include <string>
#include "tree.h"
int menu(); // menu function to send i/o to proper sections of program
int main() // start of main function
{
menu(); // call to menu function
return 0;
} // end of main function
// ****** start of menu functon *******************
int menu()
// ***** declaired variables for use with menu **************
{
string action;
int num;
tree tree1;
do // start of do/while loop
{
cout << "bst> "; // main output
cin >> action;
if(action == "quit") // start of conditionals
{
break;
}
elseif(action == "add") // adds node
{
cin >> num;
tree1.add(num);
}
/*
else if(action == "delete") // deletes a node
{
cin >> num;
tree1.xdelete(num);
}
else if(action == "search") // compares input to nodes looking for a match
{
cin >> num;
tree1.search(num);
}
else if(action == "height") // prints out how tall the tree is
{
tree1.height(node*);
}
else if(action == "inorder") // prints out the tree inorder
{
tree1.inorder(node);
}
else
{
cout << "Error! Invalid Command!" << endl; // err command
}
*/
}while(action != "quit");
} // end of do/while loop