hlp with Trees

this is my program

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
 
#include <iostream.h>
#include <string>

struct CropType
{
        string crop;
        string farmer;
        string color;
};

CropType myCrop;

struct TreeNode
{
        CropType info;
        TreeNode* left;
        TreeNode* right;
};

void Insert (TreeNode*& root, CropType item);
void Inorder (TreeNode* root);


int main()
{
        string command;

        TreeNode* root;
        root = new TreeNode;

   do
:99

      return 0;
}

void Insert(TreeNode*& root, CropType item)
{
  if (root==NULL)
  {
      root = new TreeNode;
      root->left = NULL;
      root->right = NULL;
      root->info = item;
  }
  else if (item < root->info)
  {
                Insert(root->left, item);
  }
  else
  {
                Insert(root->right, item);
  }
}

void Inorder (TreeNode* root)
{
   if(root != NULL)
   {
      Inorder(root->left);
      cout << root->info;
      Inorder(root->right);
   }
}


i'm still having problwms could somebody help me.
Last edited on
Topic archived. No new replies allowed.