From aad6a3dbf1e7fd651e3dc8cc6ba3a30d41c2ba73 Mon Sep 17 00:00:00 2001 From: Anzhelika Nikolaieva Date: Mon, 6 Nov 2023 20:40:00 +0000 Subject: [PATCH] Update 'cv7/a_station.c' --- cv7/a_station.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cv7/a_station.c b/cv7/a_station.c index 60dafa0..ebd316e 100644 --- a/cv7/a_station.c +++ b/cv7/a_station.c @@ -34,6 +34,14 @@ int select_track(struct station* station, const char* target){ void add_target_capacity(struct station* station,const char* target, int capacity){ int track = select_track(station, target); + struct car* new_car = (struct car*)malloc(sizeof(struct car)); + while (aktualna != NULL) { + if (strcmp(aktualna->value, target) == 0) { + aktualna->capacity += capacity; + return; + } + aktualna = aktualna->next; + } struct car* new_car = (struct car*)malloc(sizeof(struct car)); strncpy(new_car->value, target, TARGET_SIZE); new_car->capacity = capacity;