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
|
#include "card_games.h"
#include <iostream>
#include <ctime>
#include <cstdlib>
#include <cstdio>
#include <string>
using std::cin;
using std::cout;
using std::endl;
string StudPoker::deckFunction () {
srand(time(0));
struct card deck[52];
const string ranks[ ] = { "Ace", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight",
"Nine", "Ten", "Jack", "Queen", "King" };
const string suits[ ] = { "Diamonds", "Hearts", "Spades", "Clubs" };
int k = 0;
for ( int i = 0; i < 13; i++)
{
for ( int j = 0; j < 4; j++)
{
deck[ k ].rank = ranks[ i ];
deck[ k ].suit = suits[ j ];
k++;
}
}
int RandIndex = rand() % 13;
int RandIndex2 = rand() % 4;
/*cout << ranks[RandIndex];
cout << " of ";
cout << suits[RandIndex2];
*/
return ranks[RandIndex] + " of " + suits[RandIndex2];
}
/*void StudPoker::(ranks, suits) {
}
*/
|