Why cannot initialize my array of strings in my constructor? I get the following error: internal compiler error: Segmentation fault|
at these two lines in the constructor: suits = {"Clubs", "Diamonds", "Hearts", "Spades"}; denominations = {"Ace","2","3","4","5","6","7","8","9","10","Jack","Queen","King"};
class Card
{
public:
Card(int n);
Card(string d, string s);
int getNumber();
string getDenomination();
string getSuit();
void setNumber(int n);
void setDenomination(string d);
void setSuit(string s);
void printMe();
void compareMe(Card c);
private:
int number;
string denomiation;
string suit;
string suits [4];
string denominations [13];
};
Card::Card(int n)
{
suits = {"Clubs", "Diamonds", "Hearts", "Spades"};
denominations = {"Ace","2","3","4","5","6","7","8","9","10","Jack","Queen","King"};
int denIndex, suitIndex;
denIndex = 51 % 13;
suitIndex = 51 / 13;
number = n;
denomiation = denominations[denIndex];
suit = suits[suitIndex];
}