So I have to write a poker game program, and I have to sort the cards by value before checking them. I have the functions to deal the cards to each player. I just need to sort them. Here is the bubblesort function.
}
*/
//Something is wrong with Hands.Value & Hands.Suit
}
Cards is a struct that holds the suits and values by the way. I just can't get this function to work for some reason.
It gives me a squiggly line underneath the Hands in Hands.Value and Hands.Suit, and when I go over it, it says "Error: expression must have class type" I'm not sure what to do in this case. I don't know if I have to post my whole code to help with this function.
First of all, I see that you are new to the forum, so don't worry about it this time, but it makes life a huge amount easier if you use [.code]<code goes here>[./code] tags. (Without the period at the start of each tag).
Anyways, the problem is that arrays are treated as pointers and cannot have fields.
The solution is to have Hands[j][i].Value instead of Hands.Value[j][i] *note where the [j][i] goes.