ghsghjsgjhsg

This commit is contained in:
Anton Dolozin 2025-11-05 00:41:38 +01:00
parent 09c80a77a9
commit b6be23c5df

View File

@ -91,18 +91,28 @@ int get_target_capacity(struct station* station,const char* target){
}
int count_targets(struct station* station){
return 0;
int count = 0;
if(*station->tracks == NULL || station == NULL){
return 0;
}
struct car* ptr = *station->tracks;
while (ptr)
{
count++;
ptr = ptr->next;
}
return count;
}
int count_capacity(struct station* station){
int res = 0;
struct car* ptr = *station->tracks;
while (ptr && ptr->next){
while (ptr){
res += ptr->capacity;
ptr = ptr->next;
}
res += ptr->capacity;
return res;
}