-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtree_test.cpp
More file actions
45 lines (34 loc) · 904 Bytes
/
tree_test.cpp
File metadata and controls
45 lines (34 loc) · 904 Bytes
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
//============================================================================
// Name : cs4511.cpp
// Author :
// Version :
// Copyright : Your copyright notice
// Description : Hello World in C++, Ansi-style
//============================================================================
#include <iostream>
#include <cstdlib>
#include "Tree.h"
#include "Node.h"
using namespace std;
int main(int args, char** argv) {
cout << "start Tree Test" << endl;
int i = 5;
int* x = new int(10);
Tree<Node<int>,int> tree(x);
srand ( time(NULL) );
while (i > 0) {
//cout << "step " << i << endl;
int* in = new int(rand()%100);
Node<int>* n = new Node<int>(in);
tree.addChild(n);
for (int j = 0; j < 3; j++) {
int* inn = new int(rand()%100);
Node<int>* m = new Node<int>(inn);
n->addChild(m);
}
i--;
}
tree.print();
cout << "done" << endl;
return 0;
}