I am creating a deck of bingo cards. The deck knows the amount of cards in the deck, the size of the cards, and the max number to appear on the card.
I want to create n arrays (cards) of unique random integers and then add each of these arrays to each element of another array (the deck). So, an array of arrays.
Ex.
card1 = {1, 2, 5};
card2 = {3, 7, 2};
deck = {card1, card2};
Here is my code so far:
Deck::Deck(int cardSize, int cardCount, int numberMax){
int randInt;
int size = cardSize * cardSize;
int deckArr[cardCount];
for(int t = 0; t < cardCount; t++){
int arr[size];
for(int i = 0; i < size; i++){
randInt = computeRandInt(numberMax, cardSize);
if(arr[i] == 0) arr[i] = randInt;
else if (randInt != arr[i-1]) arr[i] = randInt;
}
deckArr[t] = arr;
}
}
I get the error invalid conversion from ‘int*’ to ‘int’. How do I declare my deck array to store these card arrays?
int deckArr[cardCount]--int arr[size];-- This is not valid C++. An array in C++ must be declared using a constant to denote the number of entries, not a variable. Usestd::vector<int>instead.