Exemplo n.º 1
0
int Level::DefineLevel(Cards c)
{
    int i;
    int sameNumber1=0,sameCount1=2;
    int sameNumber2=0,sameCount2=2;
    c.sort();
	bool Straight=true,Flush=true;
   for (i=1;i<5;i++)
   if (c.element[i].color!=c.element[i-1].color)
   {
          Flush=false;
          break;
   }
   for (i=1;i<5;i++)
   if (!((c.element[i].num-1==c.element[i-1].num) || ((i==4) && c.element[i].num-9==c.element[i-1].num)))
   {
      Straight=false;
      break;
  }
  if (Straight && Flush)
  {
     if (c.element[0].num==1 && c.element[1].num==10) return 9;
     else return 8;
  }
  if (Straight) return 4;
  if (Flush) return 5;
  return 0;
}
Exemplo n.º 2
0
int main()
{
    Cards cards;
    cards.printCards();
    std::cout << std::endl;
    cards.sort();
    cards.printCards();
    std::cout << std::endl;

    displayCard(cards.getCard(1, 4));
    std::cout << std::endl;
    displayCard(cards.getCard(1, 4));
    std::cout << std::endl;
    cards.printCards();
    std::cout << std::endl;
    return 0;
}