Advertisement
Purianite

Untitled

Sep 22nd, 2011
387
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.37 KB | None | 0 0
  1. //binarytree.cpp
  2. #include <iostream>
  3. #include "binarytree.h"
  4.  
  5. using namespace std;
  6.  
  7.  
  8.  
  9. int main(int argc, char* argv[])
  10. {
  11.     PlayerBST tree;
  12.  
  13.     Player miyako("Miyako", "Mage", 250, 525, 13, 13000);
  14.     Player sakura("Sakura", "Rogue", 300, 70, 10, 10500);
  15.     Player kaori("Kaori", "Necromancer", 75, 132, 2, 1200);
  16.     Player kyousuke("Kyousuke", "Knight", 500, 50, 12, 12755);
  17.     Player tuomas("Tuomas", "Berserker", 890, 105, 25, 25999);
  18.     Player jack("Jack", "Ranger", 430, 50, 20, 20943);
  19.     Player ayame("Ayame", "Spellblade", 600, 275, 31, 31225);
  20.     Player ayako("Ayako", "Healer", 500, 900, 29, 29175);
  21.  
  22.     tree.insert(miyako);
  23.     tree.insert(sakura);
  24.     tree.insert(kaori);
  25.     tree.insert(kyousuke);
  26.     tree.insert(tuomas);
  27.     tree.insert(jack);
  28.     tree.insert(ayame);
  29.     tree.insert(ayako);
  30.  
  31.     cout << "Tree contents before sorting:\n";
  32.     miyako.playerDisplay();
  33.     sakura.playerDisplay();
  34.     kaori.playerDisplay();
  35.     kyousuke.playerDisplay();
  36.     tuomas.playerDisplay();
  37.     jack.playerDisplay();
  38.     ayame.playerDisplay();
  39.     ayako.playerDisplay();
  40.     cout << "After sorting by level:\n";
  41.     tree.inorder();
  42.     cout << "Breadth first:\n";
  43.     tree.breadthFirst();
  44.     cout << "Searching for the level 25 player:\n";
  45.     tree.search(25);
  46.     //void deleteByMerging(BSTNode<T>*&);
  47.     //void findAndDeleteByMerging(const T&);
  48.     //tree.inorder();
  49.     //cout << "Value of node = " << *tree.search(10);
  50.  
  51.     cin.get();
  52.     return 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement