blob: 10534f3a229c3060f22d5489e33dfb2661101c62 (
plain)
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
66
67
68
69
70
71
72
73
74
|
/*
* main.cpp
*
* Created on: Jan 25, 2017
* Author: jonas
*/
#include <iostream>
#include <string>
#include <sstream>
#include "cTree.h"
using namespace std;
cTree* a;
void fill()
{
for (char b = ' '; b <= '~'; b++) //insert some data into tree
{
for(char c = ' '; c<= '~'; c++)
{
stringstream ss;
ss << b;
ss << c;
a->insert(ss.str());
}
}
}
int main (void)
{
a = new cTree();
int iInputOption;
while (1)
{
cout << "[1] Fill with Data\n";
cout << "[2] Clear\n";
cout << "[3] Balance\n";
cout << "[4] Draw\n";
cout << "[5] Info\n";
cout << "> ";
cin >> iInputOption;
switch(iInputOption)
{
case 1:
cout << "Filling with Data.....";
fill();
cout << "OK\n";
break;
case 2:
a->clear();
break;
case 3:
a->sort();
break;
case 4:
a->draw();
break;
default:
cout << "Unrecognized Command\n";
break;
}
}
delete a;
return 0;
}
|