From 557451ce56e0fe24b335036d84007691deac417a Mon Sep 17 00:00:00 2001 From: VIliam Date: Mon, 4 Nov 2024 14:09:52 +0100 Subject: [PATCH] cv6 --- cv6/a_station.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/cv6/a_station.c b/cv6/a_station.c index 7b8b276..2d5fb25 100644 --- a/cv6/a_station.c +++ b/cv6/a_station.c @@ -61,6 +61,13 @@ int count_targets(struct station* station){ } int count_capacity(struct station* station){ - return 0; + int total_capacity = 0; + for (int i = 0; i < station->track_count; ++i) { + struct car* current = station->tracks[i]; + while (current) { + total_capacity += current->capacity; + current = current->next; + } + } + return total_capacity; } -