well, for now I decided to stick to my strtok() parser from the previous post. But now another question arises. I need to keep a running number of sets, and at the same time manipulate them...the max number of sets is 20, but with N number of members.
I made a class called Sets which will do all these manipulations for me as well as create and delete sets. I'm not sure what approach I should take in creating the new sets, should I use an array of pointers? but how can I dynamically allocate the space for the sets. Lets say that
Code:
array element | points to the set
------------------------------------------
0 {1 2 6 8}
1 {1 23}
2 { 1 through 100 }
3-19 empty
If I make a two dimensional array I have to declare it in the beginning but cant because the number of members is unkown.
Which ADT should I go with to keep this relatively simple?
here is the beginning of the sets class
Code:
//FILE: sets.h
class Sets
{
private:
int value1;
int value2;
public:
//declaring constructor
Sets();
//declaring set functions
void set( int );
void set( int, int );
//declaring get functions
int getVal1() { return value1; }
int getVal2() { return value2; }
};
//=========================
Sets::Sets()
{
}
//=========================
void Sets::set( int val1 )
{
value1 = val1;
}
//=========================
void Sets::set( int val1, int val2 )
{
value1 = val1;
value2 = val2;
}
thanks