From b6be23c5df75914db8404fb1bdc99f37ecc77dc9 Mon Sep 17 00:00:00 2001 From: Anton Dolozin Date: Wed, 5 Nov 2025 00:41:38 +0100 Subject: [PATCH] ghsghjsgjhsg --- du5/a_station.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/du5/a_station.c b/du5/a_station.c index 9a3bec1..e9d9a38 100644 --- a/du5/a_station.c +++ b/du5/a_station.c @@ -91,18 +91,28 @@ int get_target_capacity(struct station* station,const char* target){ } int count_targets(struct station* station){ - return 0; + int count = 0; + if(*station->tracks == NULL || station == NULL){ + return 0; + } + struct car* ptr = *station->tracks; + while (ptr) + { + count++; + ptr = ptr->next; + } + return count; + } int count_capacity(struct station* station){ int res = 0; struct car* ptr = *station->tracks; - while (ptr && ptr->next){ + while (ptr){ res += ptr->capacity; ptr = ptr->next; } - res += ptr->capacity; return res; }