I am facing a very simple problem that many of you will be able to solve, however I'm having a hard time trying to figure a method to program this.
I am trying to create a dynamic array with the many prices of different clothing for a shop I'm creating.
The prices depend on the colour - I know it's stupid, and some of the clothing don't have all the colours available.
I have managed to create in my program, a structure that is very much like this
struct item{
string cloth;
string colour;
double price;};
Then I created
Item list[maxnumber]
(my maxnumber is a constant that I have defined on the beginning of the class)
I will read a text in this format
cloth,colour,price
and send the information to the list I have created.
And I already did that.
So now my list that is structured pretty much like this:
list
-- Item 1 -- Item 2 -- Item 3 -- etc...
---cloth1----cloth2 ---cloh3-----etc...
--color1----color1----color3----etc...
----10---------5-------12-------etc...
What I want to do and only need a suggestion, is the next step where I should create a dynamic array, for example lister [3][3], and then define it as something like this:
cloth: -- cloth1 -- cloth2 -- cloth 3 --
Colour:
|
|
colour1 ---10----------5---------NULL----
|
|
colour2 ---NULL-------NULL-------NULL----
|
|
colour3 ---NULL-------NULL-------12------
according to the example I'm using.
What should I do to be able to do that?