In "Main.cpp", line 63 should be cout << "Number inserted:" << num << endl;
In "Main.cpp", there are multiple problems with "ProcessMenu".
- No "do" for the while statement
case1
should becase 1
(you need a space between the word "case" and the number 1)- In "ShowMenu" you offer an option to print, but don't have a case statement for it in "ProcessMenu"
- You don't offer an option to quit
Try the following for ShowMenu:
int ShowMenu(void)
{
int option;
cout << "\n\t" << endl;
cout << "\t\t===============================" << endl;
cout << "\t\t1. Insert into tree" << endl;
cout << "\t\t2. Print tree" << endl;
cout << "\t\t3. Quit" << endl;
cout << "\t\t===============================" << endl;
cout << endl;
cout << "Choose an option: ";
cin >> option;
return option;
}//ShowMenu
Try the following for "ProcessMenu":
void ProcessMenu(TreeType<T>& tree)
{
bool quit = false;
do{
switch (ShowMenu())
{
case 1:
InsertItem(tree);
break;
case 2:
PrintTree(tree);
break;
case 3:
quit = true;
break;
default:
cout << "Error: Invalid option. Try again." << endl;
}//switch
} while (!quit);
}//ProcessMenu