So; I have to determine if there is a) 3 of a kind b)4 of a kind c)straight.
I have put the 7 cards into a 1 dimensional array and sorted them but I also need a case for not being more than 4 cards. I don't need to include suits.
Here is what I have done:
include<iostream>
using namespace std;
include<cmath>
include<ctime>
include<cstdlib>
include<iomanip>
int main()
{
const int size=7;
int cards[size]={};
const int b=13;
int tem[b]={0};
int a; int p;
srand(time(0));
for(int i=0; i<10; i++)
{ for (int s=0; s<size; s++)
{ cards[s]=1+rand()%13; }
int i = 0, temp;
while( i < size ){
if ( i == 0 || cards[i - 1] <= cards[i] )
i++;
else{
temp =cards[i];
cards[i] = cards[i - 1];
cards[--i] = temp;}}
for (p=0; p<b; p++)
{tem[p-1]++;
if(tem[p]==3)
for (int m=0; m<size; m++)
cout<<setw(4)<<cards[p]; cout<<"Three of a kind. ";
cout<<endl;} }
system("pause");
return 0;
}
it does not work though
4 of a kind is about the same as 3 of a kind
no idea for the straight
henri18 0 Newbie Poster
Clinton Portis 211 Practically a Posting Shark
henri18 0 Newbie Poster
lxXTaCoXxl 26 Posting Whiz in Training
Lerner 582 Nearly a Posting Maven
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.