I have two vectors, one is full of numbers and the other with suits (a deck of cards if they are put together). After I print out the first five elements of each (a "hand"), I need to determine if that "hand" contains 2 of a kind. I am so stumped on how to do this! what I have so far is below:
void fillvector(vector<string> &N, vector<string> &S);
void shuffledeck(vector<string> &N, vector<string> &S);
void printdeck(int i, vector<string> &N, vector<string> &S);
void printfive(int i, vector<string> &N, vector<string> &S);
void evaluatehand(int pos, int i, int pair, vector<string> &N, vector<string> &S);
int main(int argc, char *argv[])
{
vector<string> N, S;
srand ( unsigned ( time (NULL) ) );
int i = 0;
int pos;
int pair = 0;
fillvector(N, S);
shuffledeck(N, S);
printdeck(i, N, S);
printfive(i, N, S);
evaluatehand(pos, i, pair, N, S);
system("PAUSE");
return EXIT_SUCCESS;
}
void fillvector(vector<string> &N, vector<string> &S)
{
//Aces are high (14)
void printfive(int i, vector<string> &N, vector<string> &S)
{
cout << "The hand you have been dealt is: ";
for(i= 0 ; i < 5; i++ )
{
cout << N[i]<< S[i] << " ";
}
cout << endl;
}
void evaluatehand(int pos, int i, int pair, vector<string> &N, vector<string> &S)
{
for (i = 0; i < 5 ; i++)
{
pos=N.search("2", 0);
if(pos != string::npos)
{
if( pos < 5)
{
pair++;
if (pair == 2)
{
cout << "You drew a pair of twos!" << endl;
}