I have all my code working except sort function .
I need to sort the cards in hand......and I am having hard time with that....
Any help would be really helpful ;)
Expand|Select|Wrap|Line Numbers
- class hand{
- private:
- string theSuits; // contains suits in order
- string theValues; // contains values in order
- int numcards;
- public:
- unsigned size;
- acard* handcards; // an array of cards
- hand();
- ~hand();
- void sortit( unsigned size);
- void show();
- void shuffle();
- };
- void hand::sortit(unsigned size) {
- sort(handcards, handcards + size);
- for ( int i=0; i < size; ++i){
- cout << h.handcards[i].str<< " " ; }
- cout << endl;
- }
- int main()
- {
- int cardnum(0);
- string h[5];
- srand(time(0));
- deck mydeck;
- mydeck.show();
- mydeck.shuffle();
- mydeck.show();
- hand myhand1;
- hand myhand2;
- hand myhand3;
- hand myhand4;
- mydeck.hands(myhand1, 6);
- //myhand1.sortit(6);
- mydeck.hands(myhand2, 6);
- mydeck.hands(myhand3, 6);
- mydeck.hands(myhand4, 6);
- system("pause");
- return 0;
- }