I wrote a simple little program for my business a while ago in Python and I would really like to rewrite it in C (or maybe even C++) as an exercise. However I'm having trouble visualizing how to do the same thing in C.
Its function is very simple. I use multiple Outlook calendars to keep work schedules for my employees. They have recurring appointments with regular clients every week as well as various other appointments. The appointments are stored in Outlook as the name of the client and the fee. At the end of every week I need to tally up all of the appointments and their fees and display a summary to help me when I do the books. It's a pain to do by hand because clients sometimes have appointments at various different fees and may be seen by more than one employee during the week.
I export the calendars into text files containing tab separated values with two fields - client/fee. My current program reads the files line by line, splits the line by the tab and feeds the data into a Python dictionary whose keys represent the clients and the value of each key is another nested dictionary whose keys are the different fees (in string form) and the value of those keys is a numeric tally. It's then a simple matter to calculate totals and print a detailed summary like the following for each client:
What would be the best way to achieve the same in C? Would it be a linked list of structs (one for each client) each containing a link list of structs (for each fee)? I can't seem to wrap my head around it and it just seems like it should be so simple. I don't want to have a set number of fees either, it has to be open ended because sometimes negotiations are made and different fees charged.Code:P Taylor 5 @ $15 2 @ $17.50 2 @ $20 Total: $150