Update 'cv7/a_station.c'
This commit is contained in:
parent
24be707239
commit
aad6a3dbf1
@ -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;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user