Hi, I'm working on a problem that asks to create a set of cards in a 2D array, shuffle it then sort it.
I have done everything except the sorting part, because I don't know how to make the string "Hearts-Ace" greater than "Hearts-King", and how to make Hearts > Diamonds > Spades > Clubs.
Can anyone help ??
If so, you should consider implementing your own card class, it will make this task, and every other task you could possibly do with a card easier.
To do it with what you have (If you really must, for whatever ungodly reason), I would use a regular expression to split each card from the -, use standard string comparison to sort first by suit into Deck[x], then using an insertion sort on the value of the card using a function to determine the value in an integer, such as: