Added search function
This commit is contained in:
parent
e6d12c5c1c
commit
d5ec73c414
@ -61,9 +61,12 @@ int get_target_capacity(struct station* station,const char* target){
|
||||
int res = select_track(station, target);
|
||||
struct car** ptr = &station->tracks[res];
|
||||
struct car* head = *ptr;
|
||||
if(head){
|
||||
while (head)
|
||||
{if(strcmp(head->value, target) == 0){
|
||||
return head->capacity;
|
||||
}
|
||||
head = head->next;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -101,3 +104,4 @@ int count_capacity(struct station* station){
|
||||
return total;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user