algerino83 0 Newbie Poster

i need to create a deck of cards and shuffle it as well and display and sort 4 cards as a hand ahich i have done already
please i need to include straight, full house, pair, 3 of a kind and 4 of a kind i have no clue how to do it
please help asap
her's my code

#include <iostream>
#include <ctime>
#include <cmath>
#include <cstdlib>
#include <string>
#include <vector>
#include <algorithm>

using namespace std;

class Card

private:

    {
    string ran, suis;
    int pairs;
public:


        void setCard(string r, string s)


    {
        ran = r;
        suis = s;
    }
    string getrank()
    {
        return ran;
    }
   string getsuit()


       {


       return suis;


    friend bool compare(const Card& lhs, const Card& rhs);
};
 bool compare (const Card& lhs, const Card& rhs)
 {
     return lhs.ran<rhs.ran
;
 }
const std::string RANK[] = { "Ace", "Deus", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Jack", "Queen", "King" };
const std::string SUITS[] = {"Diamonds \004", "Hearts \003", "Spades \006", "Clubs \005"};

class Deck
{
private:
    std::vector<Card> cards;
    int current;


public:
    Deck();
    ~Deck();
  Card drawCard();
   void shuffle();
  void printdeck();
  void sorthand();
  void printhand();
 void printHandType();
void PokerGame();


};

Deck::Deck()

{
    current = 0;
    for (int i = 0; i < 13; i++)
    {
        for (int j = 0; j < 4; j++)
        {
            Card t;
            t.setCard(RANK[i], SUITS[j]);
            cards.push_back(t);

        }
    }

}
void Deck::printdeck()///it prints the whole deck!!
{
    for(int j = 0; j < cards.size(); j++)

    {
        cout<< cards[j].getrank() << " " << cards[j].getsuit() <<"\n";
    }
}
Deck::~Deck() {}
void Deck::sorthand()///sort the hand or the five cards hand!!
{
    sort (cards.begin(), cards.begin() +5, compare );

}
void Deck::printhand()/// print the hand or the five cards hand!!

{
    for(int x =0; x<5; x++)
    {
        cout << cards[x].getrank() << " " << cards[x].getsuit() <<"\n";

    }
}


void Deck::shuffle() ///shuffles the Deck!!

{
    srand(unsigned(time(NULL)));
    random_shuffle(cards.begin(), cards.end());
}

Card Deck::drawCard()
{
    Card &temp = cards[current];
    current++;
    return temp;
}///main functions
int main()
{
    Deck jeux;
    jeux.printdeck();
    jeux.shuffle();
    cout << endl;
    jeux.printdeck();
    cout <<endl;
    jeux.printhand();
    cout <<endl;
    jeux.sorthand();
    jeux.printhand();
    srand(time(0));
    int deck[52];

}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.