1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
|
#include <iostream>
#include <algorithm>
#include<ctime>
# include "card.h"
#include "carddeck.h"
#include <cstdlib>
// #include "randomdraw.h"
// #include "isempty.h"
bool CardDeck::isempty(){
void Card::randomDraw(
}
void CardDeck::randomDraw(){
void Card::randomDraw(
}
using namespace std;
int main()
{
static const char *ranks[] =
{
"Ace", "Two", "Three", "Four", "Five", "Six", "Seven",
"Eight", "Nine", "Ten", "Jack", "Queen", "King"
};
static const char *suits[] =
{
"Spades", "Clubs", "Diamonds", "Hearts"
};
int print_card(int n)
{
int count=0;
int j,i;
int sum=0;
i=n/13;
j=0;
if(count==4)
{
cout<<"Number of picks: "<<sum<<endl;
return 0;
}
else
{
if(j!=i)
{
if(n/13==4 && count<5)
{
cout << ranks[n % 13] << " of "<< suits[0] << endl;
count++;
sum++;
}
else if(count<5)
{
cout << ranks[n % 13] << " of "<< suits[n / 13] << endl;
count++;
sum++;
}
j=i;
}
}
}
int main()
{
srand((unsigned int)time(NULL));
// initialize you card class first
CardDeck cd;
int deck[52];
// Prime, shuffle, dump
for (int i=0;i<52;deck[i++]=i);
random_shuffle(deck, deck+52);
for_each(deck, deck+52, print_card);
system ("pause");
return 0;
}
|