static void Main(string[] args) { var bst = new BinarySearchTree(); char c; do { PrintMenu(); if (!TryGetChar(out c)) { BadInput(); } else { switch (c) { case 'a': if (!TryGetInt(out int i, "Enter the value to add")) { BadInput(); } else { bst.Insert(i); } break; case 'p': BTreePrinter.Print(bst.Root); break; case 'b': bst.PrintBfs(); break; case 'd': bst.PrintDfs(); break; } } } while (c != 'q'); }