SantiagoFox Posted 23 February 2014 Posted 23 February 2014 Yes, int myHand[5]; for (int i=0; i<5; i++) { myHand = m_pHand1->GetCardAtPosition(i); } then pass myHand to HandCheck. I'd also make HandCheck return a bool.
SantiagoFox Posted 23 February 2014 Posted 23 February 2014 So getcardatposition returns a ponter to a Card? could you post the code?
Trumpet Posted 23 February 2014 Author Posted 23 February 2014 m_pHand1 is a pointer to a hand of cards. Hand* m_pHand1; Then the getcardatposition() identifies individual cards within that hand 0-4.
SantiagoFox Posted 23 February 2014 Posted 23 February 2014 Please post the function. Maybe you just ned to dereference the return value to a Card
Trumpet Posted 23 February 2014 Author Posted 23 February 2014 int HandCheck(Card iHand[5]) { //Royal Flush //return 10; //Straight Flush //return 9; //Four of a kind //return 8; //Full House //return 7; //Flush //return 6; if(iHand[0].GetSuit() == iHand[1].GetSuit() && iHand[2].GetSuit() == iHand[3].GetSuit() && iHand[3].GetSuit() == iHand[4].GetSuit()) { cout << "Flush" <<endl; return 6; } //Straight //return 5; //Three of a kind //return 4; //Two Pair //return 3; //Pair //return 2; //High Card //return 1; return 0; }
SantiagoFox Posted 23 February 2014 Posted 23 February 2014 I meant the definition of GetCardAtPosition. If it returns a *Card, then dereference . Got to pop out in a minute!
Trumpet Posted 23 February 2014 Author Posted 23 February 2014 Card* GetCardAtPosition(int iPos); So i'm taking the * out?
SantiagoFox Posted 23 February 2014 Posted 23 February 2014 Either take it out of this function, or dereference it outside. Off out now. Good luck
Trumpet Posted 24 February 2014 Author Posted 24 February 2014 Had a rethink. The m_pHand doesn't need to be passed to the function, the function just needs to be a member of the class cardgame. Slowly getting there!
Recommended Posts
Archived
This topic is now archived and is closed to further replies.