From 243cecf9c4cb4a9721fc96b0d948b7ccc5bba412 Mon Sep 17 00:00:00 2001
From: Alec <alec.schmidt@hesge.ch>
Date: Thu, 2 Jun 2022 13:12:05 +0200
Subject: [PATCH] on sait jamais je lui fait pas confiance

---
 bp_tree.c |  2 +-
 main.c    | 58 +++++++++++++++----------------------------------------
 2 files changed, 17 insertions(+), 43 deletions(-)

diff --git a/bp_tree.c b/bp_tree.c
index 9378067..51b33bc 100644
--- a/bp_tree.c
+++ b/bp_tree.c
@@ -379,7 +379,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 3d2cafb..05ce826 100644
--- a/main.c
+++ b/main.c
@@ -4,57 +4,31 @@
 #include <stdlib.h>
 int main() {
     node *tree = bp_create_node();
-    entry person;
-
-    for (int i = 0; i < 10; i++) {
-        person.phone[i] = '1';
-    }
-    person.phone[10] = '\0';
-
-    tree = bp_insert_val(tree, person);
-    bp_print(tree, 0);
-
-    printf("\n|||||||||\n");
-
-    for (int i = 0; i < 10; i++) {
-        person.phone[i] = '2';
-    }
-
-    tree = bp_insert_val(tree, person);
-    bp_print(tree, 0);
-
-    printf("\n|||||||||\n");
 
-    for (int i = 0; i < 10; i++) {
-        person.phone[i] = '3';
-    }
-
-    tree = bp_insert_val(tree, person);
-    bp_print(tree, 0);
-
-    printf("\n|||||||||\n");
-
-    for (int i = 0; i < 10; i++) {
-        person.phone[i] = '4';
-    }
+    entry person;
 
+    strcpy(person.f_name, "Alec\0");
+    strcpy(person.l_name, "Schmidt\0");
+    strcpy(person.phone, "0789444425\0");
     date test = {.day = 26, .month = 5, .year = 101};
+    person.birth = test;
+    tree = bp_insert_val(tree, person);
 
-    person.l_name[0] = 'S';
-    person.f_name[0] = 'A';
-    person.f_name[1] = 'l';
-    person.f_name[2] = 'e';
-    person.f_name[3] = 'c';
-    person.f_name[4] = '\0';
+    strcpy(person.f_name, "Tanguy\0");
+    strcpy(person.l_name, "Cavagna\0");
+    strcpy(person.phone, "0766159228\0");
+    test.day = 25;
+    test.month = 5;
+    test.year = 101;
     person.birth = test;
     tree = bp_insert_val(tree, person);
-    bp_print(tree, 0);
 
-    for (int i = 0; i < 10; i++) {
-        person.phone[i] = '5';
-    }
+    char phone_search[11] = {"0789444425"};
+    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);
 
     /*
-- 
GitLab