We help IT Professionals succeed at work.
Get Started

Database handling in C

CprogBeg
CprogBeg asked
on
709 Views
Last Modified: 2012-05-06
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
Comment
Watch Question
Software Engineer
CERTIFIED EXPERT
Commented:
This problem has been solved!
Unlock 2 Answers and 2 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE