]> git.llucax.com Git - z.facultad/75.52/treemulator.git/blob - src/main_variable.cpp
Agrego clave variable.
[z.facultad/75.52/treemulator.git] / src / main_variable.cpp
1
2
3 #include "btree.h"
4 #include "clave_variable.h"
5
6 int main  (int argc, char *argv[])
7 {
8         BTree tree ("test.idx", 128, BTree::KEY_VARIABLE);
9         
10         if (argc != 2) {
11                 printf ("Falta parametro cantidad de elementos a agregar\n");
12                 return 1;
13         }
14
15         for (int i=0; i<=atoi(argv[1]); i++) {
16                 std::stringstream ss;
17                 std::string s;
18                 ss << i;
19                 ss >> s;
20                 ClaveVariable c(s);
21
22                 std::cout << "Agregando " << i << std::endl;
23                 tree.AddKey (c);
24         }
25         
26         for (int i=0; i<=atoi(argv[1]); i++) {
27                 std::stringstream ss;
28                 std::string s;
29                 ss << i;
30                 ss >> s;
31                 ClaveVariable c(s);
32
33                 if (tree.FindKey (c))
34                         std::cout << i << " encontrada\n";
35                 else
36                         std::cout << i << " NO encontrada\n";
37         }
38
39         return 0;
40 }
41