This commit is contained in:
Džubara 2024-11-04 14:05:18 +01:00
parent 08ae834f6c
commit b628b7e760

View File

@ -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){