SantiagoFox Posted 23 February 2014 Share 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. Link to comment Share on other sites More sharing options...
Trumpet Posted 23 February 2014 Author Share Posted 23 February 2014 That's what I get now. Link to comment Share on other sites More sharing options...
SantiagoFox Posted 23 February 2014 Share Posted 23 February 2014 So getcardatposition returns a ponter to a Card? could you post the code? Link to comment Share on other sites More sharing options...
Trumpet Posted 23 February 2014 Author Share 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. Link to comment Share on other sites More sharing options...
SantiagoFox Posted 23 February 2014 Share Posted 23 February 2014 Please post the function. Maybe you just ned to dereference the return value to a Card Link to comment Share on other sites More sharing options...
Trumpet Posted 23 February 2014 Author Share 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; } Link to comment Share on other sites More sharing options...
SantiagoFox Posted 23 February 2014 Share Posted 23 February 2014 I meant the definition of GetCardAtPosition. If it returns a *Card, then dereference . Got to pop out in a minute! Link to comment Share on other sites More sharing options...
Trumpet Posted 23 February 2014 Author Share Posted 23 February 2014 Card* GetCardAtPosition(int iPos); So i'm taking the * out? Link to comment Share on other sites More sharing options...
SantiagoFox Posted 23 February 2014 Share Posted 23 February 2014 Either take it out of this function, or dereference it outside. Off out now. Good luck Link to comment Share on other sites More sharing options...
Trumpet Posted 24 February 2014 Author Share 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! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.