What I need to do is represent a SPADE, HEART, DIAMOND, CLUB as a character, but every time I try to cast the enum to a char I get an error. How can I make this work?
What do you mean by represent it as a character? A character is a number, by default ASCII. An enum is also just defining a number of numerical constants, for example
Lucs code... doesn't really do anything. It defines a random char function that assigns a numerical value to a nonexistent variable, so I don't really get what he was trying to tell you.
Anyways: You can cast an enum to char. The thing is, casting spade to a character would result in \0 (ASCII 0), so you can't do it like that. Again, what exactly are you trying to achieve.
I need to fill a one character array with the suit, which is the enum cardSuit, followed by a character representing the value of the card and then add a null to the end.
I have got the value figured out and the null but I am struggling with the enum portion.