/*
Array practice
1.Create a deck of cards
2.Write a print function to print a card.
3.Write a print function to print a deck.
4.Shuffle a deck.
5.Create a random "hand".
6.Detect "three of a kind" in a hand.
*/

#include <iostream>
#include <cstdlib>
using namespace std;

const int Decksize = 52;

// function prototypes
void createDeck(int*);
// overloaded functions
void print(int);                 // print a card
void print(const int []);        // print the deck

int main()
{
    int deck[Decksize];

    createDeck(deck);
    print(deck);

    return 0;
}

void createDeck(int* d)
{
    for (int i = 0; i < Decksize; i++)
        d[i] = i;
}

void print(int c)
{
    switch (c%13)
    {
    case 0:
        cout << "two";
        break;
    case 1:
        cout << "three";
        break;
    case 2:
        cout << "four";
        break;
    case 3:
        cout << "five";
        break;
    case 4:
        cout << "six";
        break;
    case 5:
        cout << "seven";
        break;
    case 6:
        cout << "eight";
        break;
    case 7:
        cout << "nine";
        break;
    case 8:
        cout << "ten";
        break;
    case 9:
        cout << "jack";
        break;

    case 10:
        cout << "queen";

        break;
    case 11:
        cout << "king";
        break;
    case 12:
        cout << "ace";
        break;
    default:
        cerr << "error" << endl;
        exit(1);
    }
    cout << " of ";
    switch (c%4)
    {
    case 0:
        cout << "clubs";
        break;
    case 1:
        cout << "diamonds";
        break;
    case 2:
        cout << "hearts";
        break;
    case 3:
        cout << "spades";
        break;
    default:
        cerr << "error" << endl;
        exit(2);
    }
    cout << endl;
}

void print(const int*  p)
{
    for (int i = 0 ; i < Decksize; i++)
        print(p[i]);
}