I am working on an assignment that involves creating a simplified poker game. I am new to C++, but this is for class, so I am here to learn. Anyways...
After I deal each players hand vector, how would I sort the vector before it prints? They are char vectors called hand1 for player 1, and hand2 for player 2. The deck vector is a char as well, but the rank array is a string (so that the number 10 prints), and the suit array is a char (so that the actual symbols print). Instead of printing: 8<heart>, 3<club>, A<spade>, 4<spade>, 9 <diamond>, 8<club>, 2<club>, it would print: 2<club>, 3<club>, 4<spade>, 8<heart>, 8<club>, 9 <diamond>, A<spade>.
I hope this was enough information. I can send my code if you'd like to look at it. No pointers, no classes. I'm not at that level yet (unless there is no other way to do what I am asking). I can improve upon this project in my next class.
Sorting a hand of cards in poker
Page 1 of 13 Replies - 942 Views - Last Post: 20 October 2011 - 07:21 AM
Replies To: Sorting a hand of cards in poker
#2
Re: Sorting a hand of cards in poker
Posted 20 October 2011 - 02:52 AM
http://cboard.cprogr...ards-poker.html
How to choose a forum -> http://www.catb.org/...ions.html#forum
How to choose a forum -> http://www.catb.org/...ions.html#forum
#3
Re: Sorting a hand of cards in poker
Posted 20 October 2011 - 03:13 AM
Salem_c, on 20 October 2011 - 02:52 AM, said:
http://cboard.cprogr...ards-poker.html
How to choose a forum -> http://www.catb.org/...ions.html#forum
How to choose a forum -> http://www.catb.org/...ions.html#forum
Yes, that is me as well. You see, I've been working on this for 3 days now, just the hand sorting, with no luck. So in an act of desperation, I posted to multiple forums to see if I can get an accumulative amount of information that would help me. Did I post to the wrong forum? This is the C/C++ forum, correct?
Regardless, do you have any valuable information for me?
#4
Re: Sorting a hand of cards in poker
Posted 20 October 2011 - 07:21 AM
yangladesh, on 20 October 2011 - 02:31 AM, said:
I am working on an assignment that involves creating a simplified poker game. I am new to C++, but this is for class, so I am here to learn. Anyways...
After I deal each players hand vector, how would I sort the vector before it prints?
After I deal each players hand vector, how would I sort the vector before it prints?
Here's one way to sort a vector:
http://www.cplusplus...algorithm/sort/
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote





|