Link to home
Create AccountLog in
Avatar of CprogBeg
CprogBeg

asked on

Database handling in C

Ok experts, I need ideas on how to build a database using structures in C
Say you are very popular and have many friends. They like to tell you what they are doing.You need to keep track of these friends' activities.
We need to handle unknown sizes using a linked list (or linked lists). Also how to distinguish different strings and extract information from the strings.  The input data comes from a file. Since this file can be very large, your program can read the file only once.Your friends may tell you three types of activities: whom they meet and where they go. Each activity is marked with the date. From time to time, You want to know the friends' past activities by asking "What has this friend done?" or "What happened on this date?" all inputs and outputs will use text through files., no GUI builds.
The input file may be arbitrarily long. Each line can have one of the five following formats:
A year/month/date friend1 meets friend2
A year/month/date friend visits location
Q year/month/date
Q Friend
R friend leaves town
The first two add activities to your friend database. The third searches the database and reports everything that happened on that day. The fourth reports everything known so far related to this friend.  When your program reads the activities, the program produces no output. If an input line is a question, your program has to answer the question and print the results. If a question has multiple answers, the results must appear in the same order as the input file. The last removes everything related to the friend. It is possible that the friend moves back later.  In that case, treat it as a new friend.
so the sample input and output are attached.
If you could give me some ideas on how to do this, I would greatly appreciate it. or sample code about the way of the nodes and structures to use, it would be great!
Thanks for your time!!


input.txt
output.txt
ASKER CERTIFIED SOLUTION
Avatar of masheik
masheik
Flag of India image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account