Update 'cv7/a_station.c'

This commit is contained in:
Anzhelika Nikolaieva 2023-11-06 20:40:00 +00:00
parent 24be707239
commit aad6a3dbf1

View File

@ -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;