void HashTable::printMovieInventory(MovieNode *node) { if (node-> leftChild != NULL) { printMovieInventory(node-> leftChild); } std::cout << "Movie: " << node-> title << " " << node-> quantity << std::endl; if (node-> rightChild != NULL) { printMovieInventory(node-> rightChild); } }
void FinalProject::printMovieInventory(MovieNode *node){ if(node !=NULL){ //check node is empty or not, if is not empty, then if(node->leftChild) //node to left, and put into printMovieInventory function printMovieInventory(node->leftChild); cout<<"Movie: "<<node->title<<" "<<node->quantity<<endl; if(node->rightChild) //node to right, and put into printMovieInventory function printMovieInventory(node->rightChild); } }
void HashTable::printMovieInventory(){ if (root != NULL) { MovieNode *node = root; if (node-> leftChild != NULL) { printMovieInventory(node-> leftChild); } std::cout << "Movie: " << node-> title << " " << node-> quantity << std::endl; if (node-> rightChild != NULL) { printMovieInventory(node-> rightChild); } } else { std::cout << "Tree is currently empty" << std::endl; } }
void FinalProject::printMovieInventory(){ printMovieInventory(root); //display all movies in bst }