ghsghjsgjhsg
This commit is contained in:
parent
09c80a77a9
commit
b6be23c5df
@ -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;
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user