cv6
This commit is contained in:
parent
08ae834f6c
commit
b628b7e760
@ -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,6 +44,15 @@ int index = select_track(station, target);
|
||||
}
|
||||
|
||||
int get_target_capacity(struct station* station,const char* target){
|
||||
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;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user