Question
IN C PROGRAMMING LANGUAGE: I'm writing a program that reads in a file, stores its information in linked list, and then finds the oldest person
IN C PROGRAMMING LANGUAGE:
I'm writing a program that reads in a file, stores its information in linked list, and then finds the oldest person in the list, the youngest person in the list, and the amount of birthdays in each month.
As of right now, I have everything working except my function to find the oldest and youngest person.
My structs are typedef struct birthday { int day; int year; char month[50]; } birthday_t; typedef struct node { char firstName[50]; char lastName[50]; birthday_t birthday; char major[50]; char standing[50]; struct node *next; } node_t; typedef struct stats { node_t* oldestPerson; node_t* youngestPerson; int numBirthdays[12]; } list_stats_t; THESE CANNOT BE CHANGED. Month in the birthday struct CANNOT BE AN INT. Please do not change the structs.
The function declaration is list_stats_t getListStats(node_t* head); this cannot be changed. The function must iterate through the linked list to find the oldest person and the youngest person using the information in the structs provided above. I've been working on this for a few hours and can't seem to get everything to calculate properly. The years, months and days must be compared to properly find the oldest and youngest person in the list. I'd appreciate it if someone could help me figure out a good implementation for this. :) Thank you!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started