From d43cf2038b3c421c3fae70b2b8cb081881fd259d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ma=C3=ABl=20DAIM?= Date: Thu, 5 Jan 2023 10:51:54 +0100 Subject: [PATCH] Ajout de la fonction rechercheIUT --- Commun.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/Commun.c b/Commun.c index f19dfcd..e0c0761 100644 --- a/Commun.c +++ b/Commun.c @@ -87,6 +87,28 @@ bool vide(ListeDept lDept) return l->v; }*/ +int rechercheIUT(VilleIUT *tiut[], int tLog, char ville[], int *trouve) +{ + int inf,sup,t; + inf=0; + sup=tLog-1; + while(inf<=sup) + { + t=(inf+sup)/2; + if(strcmp(ville,tiut[t]->nom)==0) + { + *trouve=1; + return t; + } + if(strcmp(ville,tiut[t]->nom)<0) + sup=t-1; + else inf=t+1; + } + *trouve=0; + return inf; +} + + ListeDept rechercherDept(ListeDept lDept, char dept[], int *trouve) { if(vide(lDept))