#include #include /* run this program using the console pauser or add your own getch, system("pause") or input loop */ struct Cage { char type[10]; int age; char id[10]; }; struct QueueNode{ struct Cage node; struct QueueNode *next; }; void load_newcomers(struct QueueNode *root){ struct QueueNode *res_root = root; struct QueueNode *end_item = NULL; FILE f;int sizeType=0,sizeId=0; if((f=fopen("newcomers.bin", "rb"))==NULL){ perror("Cant open file"); return NULL; } while(!feof(f)){ struct QueueNode * item; item= (QueueNode*)malloc(sizeof(QueueNode)); fread(&sizeType, sizeof(int), 1, f); fread(item->node.type, sizeof(char), sizeType, f); fread(&item->node.age, sizeof(int), 1, f); fread(&sizeId, sizeof(int), 1, f); fread(item->node.id, sizeof(char), sizeId, f); if(res_root == NULL) { res_root = item; end_item = res_root; } else { end_item->next = item; end_item = end_item->next; } } fclose(f); } int animal_typecnt(struct QueueNode* root,char *animalType){ struct QueueNode* curr_item = root; int num=0; while(curr_item != NULL) { if(curr_item->node.type==animalType){ num++; } curr_item=curr_item->next; } return num; } int main(int argc, char *argv[]) { return 0; }