From 7d35050c06e943c77b2b68ff107dd8c02fa27443 Mon Sep 17 00:00:00 2001
From: Abdul-Malik Elmurzaev <abdul-malik.elmurzaev@etu.unistra.fr>
Date: Fri, 3 May 2024 18:37:27 +0200
Subject: [PATCH] correction fonction rech, je n'avais pas bien lu la consigne

---
 relations.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/relations.c b/relations.c
index 223ed91..868125e 100644
--- a/relations.c
+++ b/relations.c
@@ -118,15 +118,15 @@ void detruire(listeg lst){
 	}
 }
 listeg rech(listeg lst, void *x, int(*comp)(void *, void *)){
+	listeg resultat = listegnouv();
 	listeg copy = lst;
 	while(copy != NULL){
 		if( comp(x, copy->val) ){
-			return lst;
-		}else{
-			copy = copy->suiv;
+			resultat = adjqueue(resultat, copy->val);
 		}
+		copy = copy->suiv;
 	}
-	return NULL;
+	return resultat;
 }
 
 ////////////////////////////////////////
@@ -292,7 +292,8 @@ void adjRelation(Relations g, char *nom1, char *nom2, rtype id){
 
 // 4.1 listes de relations
 listeg en_relation(Relations g, char *x){
-	return NULL;
+	listeg liste = g->listDeRelations;
+	liste = rech(liste, x, compSommet);
 }
 listeg chemin2(Relations g, char *x, char *y){
 	return NULL;
@@ -307,8 +308,9 @@ bool ont_lien_parente(Relations g, char *x, char *y){
 // PRE CONDITION: les sommets correspondants � x et y sont de type PERSONNE
 // PRE CONDITION: strcmp(x,y)!=0
 bool se_connaissent(Relations g, char *x, char *y){
-	return false;
+	return 0;
 }
+
 // PRE CONDITION: les sommets correspondants � x et y sont de type PERSONNE
 // PRE CONDITION: strcmp(x,y)!=0
 bool se_connaissent_proba(Relations g, char *x, char *y){
-- 
GitLab