本文整理汇总了C++中BST::deleteValue方法的典型用法代码示例。如果您正苦于以下问题:C++ BST::deleteValue方法的具体用法?C++ BST::deleteValue怎么用?C++ BST::deleteValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BST
的用法示例。
在下文中一共展示了BST::deleteValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main(void) {
// EXERCISE 2
Player player1(10);
player1.set_name("John");
Player player2(15);
player2.set_name("Fred");
cout << player1.get_name() << " has " << player1.get_hit_points() << " health" << endl;
cout << player2.get_name() << " has " << player2.get_hit_points() << " health" << endl << endl;
// EXERCISE 3
BST* bst = new BST();
bst->insertInteger(18);
bst->insertInteger(8);
bst->insertInteger(3);
bst->insertInteger(23);
bst->insertInteger(11);
bst->printTree();
cout << "Is 11 in BST? " << bst->searchTree(11) << endl;
cout << "Is 5 in BST? " << bst->searchTree(5) << endl << endl;
bst->deleteValue(18);
bst->printTree();
// EXERCISE 4
Battleship* battleship = new Battleship();
battleship->play();
// TUTORIAL CODE
Enemy e1(2);
cout << "hit points = " << e1.get_hit_points() << "\n";
Enemy* e2 = new Enemy(2);
e2->set_hit_points(3);
cout << "hit points = " << e2->get_hit_points() << "\n";
e2->set_score(2);
cout << "score = " << e2->get_score() << "\n";
delete e2;
e2 = NULL;
cout << endl << "Enter a number to exit..." << endl;
int exit;
cin >> exit;
return 0;
}