By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,445 Members | 1,329 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,445 IT Pros & Developers. It's quick & easy.

My C project

P: 4
I have a C project for one of my courses. I 'll now give you the description of the project!

A shop has more from 1,000,000 customers. Each customer has his own member card which corresponds in one code. This code is constituted by 10 characters (ex. AB56AVF112). Depending on the money that the customer spends, he gains some points. So, I want to build a C project that it can give me information about:
1) How many times has each customer visited the shop
2) How many points has each customer gained
3) Who are the top 10 customers

I'll have two files for Input. The first text file gives me information about the money and the points (How many points correspond to a specific ammount.
(ex. 1;30;10 -> 10, 20 points etc
31;60;20 etc)
|-> 1$-30$, 31$-60$ etc

The second text file give me information about the customer and the money he spends in each visit in the shop.
(ex. ABC123DEF1;125 --> money
QWER587962;200 etc)
|-> customer's code

I don't ask you to tell me what to do, but every time that I have a question about something in the project I'll refer it here!


PS: I am sorry for my english!
Jan 2 '07 #1
Share this Question
Share on Google+
5 Replies


Ganon11
Expert 2.5K+
P: 3,652
Awesome, this project sounds interesting. Are there any complications you're having or concepts you're having trouble understanding? Post here, and we'll all be glad to give you a hand!

P.S. your english looks fine so far!

P.P.S. thank you so much for explaining your project so thoroughly!
Jan 2 '07 #2

P: 4
I have to use hash table (1 Dimension) for the project. So firstly I need a good hash function :) !!!! The Hash table includes the codes of the customers. So let's say:

Hash table:
|..............|
|..............| --> 2587ASAASQ
|..............| --> UYHTG125PO --> YUIO897QWE (collision)

...............

|..............|


I have a problem! Where will I put the money of each customer? I thought to put them in a list, something like this...

|.............| --> 2587ASAASQ --> 23586


...but in the case of a collision? Can I put them like this...

|..............| --> UYHTG125PO --> YUIO897QWE --> 25698 --> 36587

...?
Jan 6 '07 #3

P: 4
Anyone who can help?
Jan 10 '07 #4

Banfa
Expert Mod 5K+
P: 8,916
Store your customer information in a structure, your hash table can look-up into you allocated structures. Once you have found the structure for a customer it will contain all information

|..............|
|..............| --> {2587ASAASQ, 345}
|..............| --> {UYHTG125PO, 674} --> {YUIO897QWE, 234} (collision)

...............

|..............|
Jan 10 '07 #5

RedSon
Expert 5K+
P: 5,000
I have to use hash table (1 Dimension) for the project. So firstly I need a good hash function :) !!!! The Hash table includes the codes of the customers. So let's say:

Hash table:
|..............|
|..............| --> 2587ASAASQ
|..............| --> UYHTG125PO --> YUIO897QWE (collision)

...............

|..............|


I have a problem! Where will I put the money of each customer? I thought to put them in a list, something like this...

|.............| --> 2587ASAASQ --> 23586


...but in the case of a collision? Can I put them like this...

|..............| --> UYHTG125PO --> YUIO897QWE --> 25698 --> 36587

...?
Are you asking here about good strategys to use in case of collisions? In that case, linear collision avoidance is always simple to implement. Although I wonder if your professor would let you use something like google's sparse hash. I always wanted to try that data structure, but haven't found the right project for it yet.
Jan 10 '07 #6

Post your reply

Sign in to post your reply or Sign up for a free account.