From 54f923379a399164288319cb728732de30547bd0 Mon Sep 17 00:00:00 2001 From: Radovan Kofira Date: Tue, 10 Nov 2020 21:44:50 +0100 Subject: [PATCH] ach --- cv6/a_station.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/cv6/a_station.c b/cv6/a_station.c index a081b8c..9796ce3 100644 --- a/cv6/a_station.c +++ b/cv6/a_station.c @@ -53,11 +53,32 @@ void add_target_capacity(struct station* station,const char* target, int capacit } int get_target_capacity(struct station* station,const char* target){ + for(int i=0;itrack_count;i++){ + struct car* newCar= station->tracks[i]; + while (newCar->value!=NULL) + { + if(strcmp(newCar->value,target)==0){ + return newCar->capacity; + } + newCar=newCar->next; + } + } return 0; } int count_targets(struct station* station){ - return 0; + int counter=0; + for(int i=0;itrack_count;i++){ + struct car* newCar= station->tracks[i]; + while (newCar->value!=NULL) + { + counter+=1; + newCar=newCar->next; + } + + } + + return counter; } int count_capacity(struct station* station){