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
|
#include <iostream>
#include <ctime>
#include <cstdlib>
using namespace std;
int main()
{
int card1;
int card2;
int card3;
int card4;
int card5;
int card6;
int card7;
int card8;
int card9;
int card10;
//2D Array.
const int card_position = 52;
const int cardname = 52;
int deck[card_position][cardname];
//Array for suits.
string suits[52] = {"two of spades", "three of spades", "four of spades", "five of spades", "six of spades","seven of spade", "eight of spades", "nine of spades", "ten of spades", "jack of spades", "queen of spades", "king of spades", "ace of spades", "two of hearts", "three of hearts", "four of hearts", "five of hearts", "six of hearts", "seven of hearts", "eight of hearts", "nine of hearts", "ten of hearts", "jack of hearts", "queen of hearts", "king of hearts", "ace of hearts", "two of diamonds", "three of diamonds", "four of diamonds", "five of diamonds", "six of diamonds", "seven of diamonds", "eight of diamonds", "nine of diamonds", "ten of diamonds", "jack of diamonds", "queen of diamonds", "king of diamonds", "ace of diamonds", "two of clubs", "three of clubs", "four of clubs", "five of clubs", "six of clubs", "seven of clubs", "eight of clubs", "nine of clubs", "ten of clubs", "jack of clubs", "queen of clubs", "king of clubs", "ace of clubs"};
//Shuffle the deck.
srand(time(0));
card_position = rand() % suits;
//Deal two hands of five cards
cout << "Hand 1:\n";
cout << "-------\n";
cout << card1 << endl;
cout << card2 << endl;
cout << card3 << endl;
cout << card4 << endl;
cout << card5 << endl;
cout << "Hand 2:\n";
cout << "-------\n";
cout << card6 << endl;
cout << card7 << endl;
cout << card8 << endl;
cout << card9 << endl;
cout << card10 << endl;
return 0;
}// End Main.
|