I'm trying to make a function that involves other functions from classes. What it's ultimately supposed to do is check to see whether or not a hand (arr[]) has a flush. I understand there is probably a better algorithm to do this, but this works fine for what I'm trying to do. My problem is that the function is supposed to increment the float "f" each time it recognizes a flush, but my output always ends up being 0.
getSuit is a function in a class Card, and arr[] is an array of type Card. I've never written a function using the dot operator so I really have no idea if I even wrote this correctly.
Thanks for any feedback!Code:void checkFlush (Card arr[], float f) { if (arr[0].getSuit() == arr[1].getSuit() && arr[0].getSuit() == arr[2].getSuit() && arr[0].getSuit() == arr[3].getSuit() && arr[0].getSuit() == arr[4].getSuit()) f++; }
-Ryan