Hi...I need some syntax help with my game! I'm still putting together the declaration files, and I'm using a provided ADT header file, such as follows:
Code:
const int MAX_LIST = 52;
typedef CSomeClass ListItemType;
// The following structure is what I am asking questions about:
struct card
{
int value;
char suit;
};
class List
{
public:
List();
bool isEmpty() const;
int getLength() const;
void insert(int index, ListItemType newItem,
bool& success);
void remove(int index, bool& success);
void retrieve(int index, ListItemType& dataItem,
bool& success) const;
private:
ListItemType items[MAX_LIST];
int size;
int translate(int index) const;
};
Now...how would I go about building the deck to assign a value to each card structure? Because I want an array of data type cards. Of course I can just manipulate the display to show the appropriate value and suite for the card number, but this seemed funner.
I don't even have the foggiest clue. With the old-fashioned std linked list one could just typedef the list and say something like
Code:
for(int x=1; x<=52; x++)
{
cur->value = x;
}
but that doesn't really seem to apply in this case.
Thanks in advance for any suggestions!