/* Created by Anjuta version 1.0.0 */ /* This file will not be overwritten */ /* hlavni program - b-tree */ #include "btree.h" #include int N; // rad stromu P_CBTREE p_root; int main(int argc, char* argv[]) { int num; int dump_num = 0; p_root = NULL; char str_num[16]; fgets(str_num, 15, stdin); sscanf(str_num, "%d", &num); N = num; // printf("%d - rad", N); p_root = new CBTree(NULL, NULL); // vytvorime strom fgets(str_num, 15, stdin); // mezi radem a cisly je jedna volna radka while (fgets(str_num, 15, stdin)) { sscanf(str_num, "%d", &num); if (num<0) { if (p_root != NULL ) if (p_root->delete_num(-num)) { /* printf("%d vymazano.\n", num); } else { printf("%d neni ulozen.\n", num); */ } } else { if (p_root->insert_num(num)) { // printf("%d vlozeno.\n", num); // } else{ // printf("%d jiz ve stromu je.\n", num); } } } if (p_root != NULL) { p_root->dump_numbers(0, stdout); // p_root->dump_structure(0, stdout); delete p_root; } return 0; }