achhhhhhh
This commit is contained in:
parent
54f923379a
commit
0edab5145b
@ -50,6 +50,22 @@ int select_track(struct station* station, const char* target){
|
||||
}
|
||||
|
||||
void add_target_capacity(struct station* station,const char* target, int capacity){
|
||||
int i = select_track(station,target);
|
||||
struct car* slot = station->tracks[i];
|
||||
if(station->tracks[i]==NULL){
|
||||
struct car* newCar = malloc(sizeof(struct car));
|
||||
strcpy(newCar->value,target);
|
||||
newCar->capacity=capacity;
|
||||
newCar->next=slot;
|
||||
station->tracks[i]=newCar;
|
||||
}
|
||||
while (slot!=NULL)
|
||||
{
|
||||
if(strcmp(slot->value,target)==0){
|
||||
slot->capacity +=capacity;
|
||||
}
|
||||
slot=slot->next;
|
||||
}
|
||||
}
|
||||
|
||||
int get_target_capacity(struct station* station,const char* target){
|
||||
|
Loading…
Reference in New Issue
Block a user