i am writing a database program and i want to generate item codes so that all the item will be identified by this code.
the items are in categories examples (soft-drinks,wines beers ....etc )
i want to crate a function the will generate this codes for me. example a category (Array) is wines all the item codes in Wine in the Array Wine should begin with the word 'W' if it is Beers all the items codes in the Array Beer must begin with' B'.
thank u
3 replies to this topic
#1
Posted 06 November 2011 - 05:54 AM
|
|
|
#2
Posted 06 November 2011 - 10:18 AM
I'm not sure what your question is. What part are you stuck on? What do you have so far?
#3
Posted 06 November 2011 - 11:16 AM
I presume you are going to be using char Arrays then you are looking at generating random strings per category. Then a possible way to achieve that is either: 1. Keep track of the strings you generate per category(possibly another array). 2. Generate the strings per category in such a way a repeat never occurs. For example the Beer category could have strings like B1, B2, B3 etc, increasing incrementally by some amount. 3. Manually create each string code somewhere in a file then read them in(you will have to make sure you don't repeat the codes. Don't do this if the arrays are 'large'). I'm sure there are other ways, but it depends on your specifications.
Perfection of means and confusion of ends seem to characterize our age. Albert Einstein :confused:
#4
Posted 07 November 2011 - 01:19 PM
I think you might want to read : Hash table - Wikipedia, the free encyclopedia Separate Chining is what I have on my mind.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account


Back to top









