I am struggling with implementing the Poker hand ranking 2 pairs into my card game assignment. Below is the code i used to create my single pair function, but i have no idea on how to start the 2 pair function?
if it was me, i'd get the first card and iterate over the rest of the cards til i get a pair. if i do get a pair break out with true.
if not, move the second hand of the card and iterate over the remaining cards in the hand.
repeat for all the cards.
#include <iostream>
int main()
{
int arr[5] = {1,2,3,4,5}; //Two arrays of numbers.
int arr2[5] = {2,4,6,8,10};
int i = 0, j = 0; //Just for the following for loops.
for(i = 0; i < 5; ++i) //For every element in arr.
{
for(j = 0; j < 5; ++j) //For every element in arr2.
{
if(arr[i] == arr2[j]) //If they are equal.
{
std::cout << "Match found at " << i << " " << j << "\n";
}
}
}
return 0;
}