diff --git a/cv6/a_station.c b/cv6/a_station.c index b018ffa..7b8b276 100644 --- a/cv6/a_station.c +++ b/cv6/a_station.c @@ -34,7 +34,7 @@ int index = select_track(station, target); current = current->next; } - // Ak ciel neexistuje, pridá novy zaznam do zoznamu + struct car* new_car = (struct car*)malloc(sizeof(struct car)); strncpy(new_car->value, target, TARGET_SIZE - 1); new_car->value[TARGET_SIZE - 1] = '\0'; @@ -44,7 +44,16 @@ int index = select_track(station, target); } int get_target_capacity(struct station* station,const char* target){ - return 0; +int index = select_track(station, target); + struct car* current = station->tracks[index]; + + while (current) { + if (strcmp(current->value, target) == 0) { + return current->capacity; + } + current = current->next; + } + return 0; } int count_targets(struct station* station){