This commit is contained in:
Radovan Kofira 2020-11-10 21:44:50 +01:00
parent 0f80ed26de
commit 54f923379a

View File

@ -53,11 +53,32 @@ void add_target_capacity(struct station* station,const char* target, int capacit
} }
int get_target_capacity(struct station* station,const char* target){ int get_target_capacity(struct station* station,const char* target){
for(int i=0;i<station->track_count;i++){
struct car* newCar= station->tracks[i];
while (newCar->value!=NULL)
{
if(strcmp(newCar->value,target)==0){
return newCar->capacity;
}
newCar=newCar->next;
}
}
return 0; return 0;
} }
int count_targets(struct station* station){ int count_targets(struct station* station){
return 0; int counter=0;
for(int i=0;i<station->track_count;i++){
struct car* newCar= station->tracks[i];
while (newCar->value!=NULL)
{
counter+=1;
newCar=newCar->next;
}
}
return counter;
} }
int count_capacity(struct station* station){ int count_capacity(struct station* station){