diff --git a/bp_tree.c b/bp_tree.c index 51b33bc5ca6415754cbe225474dc74b8e7d7435b..6b80f94b89e201e4709cd85f790c95a54c6ba75e 100644 --- a/bp_tree.c +++ b/bp_tree.c @@ -46,6 +46,7 @@ void bp_node_shift(node *nd, int index) { for (int i = M - 1; i > index; i--) { nd->data[i] = nd->data[i - 1]; nd->childs[i + 1] = nd->childs[i]; + nd->user[i] = nd->user[i - 1]; } } @@ -379,7 +380,7 @@ void bp_print_entry(entry person) { printf("Cette personne n'existe pas\n"); return; } - printf("%ld\n", strlen(person.l_name)); + printf("NOM : %s\n", person.l_name); printf("PRENOM : %s\n", person.f_name); printf("TELEPHONE : %s\n", person.phone); diff --git a/main.c b/main.c index 05ce826237eac32b19cd8fe5605c9a0b7533bf6b..0d8a31dade6539d32ec2b08af359a3d9888306b0 100644 --- a/main.c +++ b/main.c @@ -23,13 +23,30 @@ int main() { person.birth = test; tree = bp_insert_val(tree, person); - char phone_search[11] = {"0789444425"}; + strcpy(person.f_name, "Richard\0"); + strcpy(person.l_name, "Tyarks\0"); + strcpy(person.phone, "0788909566\0"); + test.day = 7; + test.month = 10; + test.year = 99; + person.birth = test; + tree = bp_insert_val(tree, person); + + strcpy(person.f_name, "Vincent\0"); + strcpy(person.l_name, "\0"); + strcpy(person.phone, "0795787730\0"); + test.day = 24; + test.month = 5; + test.year = 101; + person.birth = test; + tree = bp_insert_val(tree, person); + + char phone_search[11] = {"0788909566"}; bp_print(tree, 0); - strcpy(person.phone, "0789444425\0"); printf("\n|||||||||\n"); printf("Recherche par n° de téléphone : \n"); - bp_search(tree, person.phone); + bp_search(tree, phone_search); /* tree = bp_insert_val(tree, 6);