× Go Back Go Back to Programming Section Menu Go Back to Home Page
13-13-13-13_CardDealer.c
/******************************************************************************************************/
/*               File Name: 13-13-13-13_CardDealer               Written by: Koral Eren               */
/******************************************************************************************************/
#include <stdio.h>
#include <stdlib.h>
#include <time.h>

int main()
{
    int arr [52], i, j;

    srand ((unsigned) time (NULL));

     for (i = 0; i < 52; i ++)
    {
        arr [i] = rand () % 52 + 1;

        for (j = (i - 1); j >= 0; j --)

        if (arr [j] == arr [i])
            i --;
    }


        printf ("\n\nPLAYER 1:      PLAYER 2:      PLAYER 3:      PLAYER 4:\n\n");

        for (i = 0; i < 13; i ++)
        {

        if (arr [i] == 1)
            printf ("spade A        ");
        else if (arr [i] == 2)
            printf ("spade 2        ");
        else if (arr [i] == 3)
            printf ("spade 3        ");
        else if (arr [i] == 4)
            printf ("spade 4        ");
        else if (arr [i] == 5)
            printf ("spade 5        ");
        else if (arr [i] == 6)
            printf ("spade 6        ");
        else if (arr [i] == 7)
            printf ("spade 7        ");
        else if (arr [i] == 8)
            printf ("spade 8        ");
        else if (arr [i] == 9)
            printf ("spade 9        ");
        else if (arr [i] == 10)
            printf ("spade 10       ");
        else if (arr [i] == 11)
            printf ("spade J        ");
        else if (arr [i] == 12)
            printf ("spade Q        ");
        else if (arr [i] == 13)
            printf ("spade K        ");
        else if (arr [i] == 14)
            printf ("heart A        ");
        else if (arr [i] == 15)
            printf ("heart 2        ");
        else if (arr [i] == 16)
            printf ("heart 3        ");
        else if (arr [i] == 17)
            printf ("heart 4        ");
        else if (arr [i] == 18)
            printf ("heart 5        ");
        else if (arr [i] == 19)
            printf ("heart 6        ");
        else if (arr [i] == 20)
            printf ("heart 7        ");
        else if (arr [i] == 21)
            printf ("heart 8        ");
        else if (arr [i] == 22)
            printf ("heart 9        ");
        else if (arr [i] == 23)
            printf ("heart 10       ");
        else if (arr [i] == 24)
            printf ("heart J        ");
        else if (arr [i] == 25)
            printf ("heart Q        ");
        else if (arr [i] == 26)
            printf ("heart K        ");
        else if (arr [i] == 27)
            printf ("diamond A      ");
        else if (arr [i] == 28)
            printf ("diamond 2      ");
        else if (arr [i] == 29)
            printf ("diamond 3      ");
        else if (arr [i] == 30)
            printf ("diamond 4      ");
        else if (arr [i] == 31)
            printf ("diamond 5      ");
        else if (arr [i] == 32)
            printf ("diamond 6      ");
        else if (arr [i] == 33)
            printf ("diamond 7      ");
        else if (arr [i] == 34)
            printf ("diamond 8      ");
        else if (arr [i] == 35)
            printf ("diamond 9      ");
        else if (arr [i] == 36)
            printf ("diamond 10     ");
        else if (arr [i] == 37)
            printf ("diamond J      ");
        else if (arr [i] == 38)
            printf ("diamond Q      ");
        else if (arr [i] == 39)
            printf ("diamond K      ");
        else if (arr [i] == 40)
            printf ("club A         ");
        else if (arr [i] == 41)
            printf ("club 2         ");
        else if (arr [i] == 42)
            printf ("club 3         ");
        else if (arr [i] == 43)
            printf ("club 4         ");
        else if (arr [i] == 44)
            printf ("club 5         ");
        else if (arr [i] == 45)
            printf ("club 6         ");
        else if (arr [i] == 46)
            printf ("club 7         ");
        else if (arr [i] == 47)
            printf ("club 8         ");
        else if (arr [i] == 48)
            printf ("club 9         ");
        else if (arr [i] == 49)
            printf ("club 10        ");
        else if (arr [i] == 50)
            printf ("club J         ");
        else if (arr [i] == 51)
            printf ("club Q         ");
        else
            printf ("club K         ");



        if (arr [i + 13] == 1)
            printf ("spade A        ");
        else if (arr [i + 13] == 2)
            printf ("spade 2        ");
        else if (arr [i + 13] == 3)
            printf ("spade 3        ");
        else if (arr [i + 13] == 4)
            printf ("spade 4        ");
        else if (arr [i + 13] == 5)
            printf ("spade 5        ");
        else if (arr [i + 13] == 6)
            printf ("spade 6        ");
        else if (arr [i + 13] == 7)
            printf ("spade 7        ");
        else if (arr [i + 13] == 8)
            printf ("spade 8        ");
        else if (arr [i + 13] == 9)
            printf ("spade 9        ");
        else if (arr [i + 13] == 10)
            printf ("spade 10       ");
        else if (arr [i + 13] == 11)
            printf ("spade J        ");
        else if (arr [i + 13] == 12)
            printf ("spade Q        ");
        else if (arr [i + 13] == 13)
            printf ("spade K        ");
        else if (arr [i + 13] == 14)
            printf ("heart A        ");
        else if (arr [i + 13] == 15)
            printf ("heart 2        ");
        else if (arr [i + 13] == 16)
            printf ("heart 3        ");
        else if (arr [i + 13] == 17)
            printf ("heart 4        ");
        else if (arr [i + 13] == 18)
            printf ("heart 5        ");
        else if (arr [i + 13] == 19)
            printf ("heart 6        ");
        else if (arr [i + 13] == 20)
            printf ("heart 7        ");
        else if (arr [i + 13] == 21)
            printf ("heart 8        ");
        else if (arr [i + 13] == 22)
            printf ("heart 9        ");
        else if (arr [i + 13] == 23)
            printf ("heart 10       ");
        else if (arr [i + 13] == 24)
            printf ("heart J        ");
        else if (arr [i + 13] == 25)
            printf ("heart Q        ");
        else if (arr [i + 13] == 26)
            printf ("heart K        ");
        else if (arr [i + 13] == 27)
            printf ("diamond A      ");
        else if (arr [i + 13] == 28)
            printf ("diamond 2      ");
        else if (arr [i + 13] == 29)
            printf ("diamond 3      ");
        else if (arr [i + 13] == 30)
            printf ("diamond 4      ");
        else if (arr [i + 13] == 31)
            printf ("diamond 5      ");
        else if (arr [i + 13] == 32)
            printf ("diamond 6      ");
        else if (arr [i + 13] == 33)
            printf ("diamond 7      ");
        else if (arr [i + 13] == 34)
            printf ("diamond 8      ");
        else if (arr [i + 13] == 35)
            printf ("diamond 9      ");
        else if (arr [i + 13] == 36)
            printf ("diamond 10     ");
        else if (arr [i + 13] == 37)
            printf ("diamond J      ");
        else if (arr [i + 13] == 38)
            printf ("diamond Q      ");
        else if (arr [i + 13] == 39)
            printf ("diamond K      ");
        else if (arr [i + 13] == 40)
            printf ("club A         ");
        else if (arr [i + 13] == 41)
            printf ("club 2         ");
        else if (arr [i + 13] == 42)
            printf ("club 3         ");
        else if (arr [i + 13] == 43)
            printf ("club 4         ");
        else if (arr [i + 13] == 44)
            printf ("club 5         ");
        else if (arr [i + 13] == 45)
            printf ("club 6         ");
        else if (arr [i + 13] == 46)
            printf ("club 7         ");
        else if (arr [i + 13] == 47)
            printf ("club 8         ");
        else if (arr [i + 13] == 48)
            printf ("club 9         ");
        else if (arr [i + 13] == 49)
            printf ("club 10        ");
        else if (arr [i + 13] == 50)
            printf ("club J         ");
        else if (arr [i + 13] == 51)
            printf ("club Q         ");
        else
            printf ("club K         ");


        if (arr [i + 26] == 1)
            printf ("spade A        ");
        else if (arr [i + 26] == 2)
            printf ("spade 2        ");
        else if (arr [i + 26] == 3)
            printf ("spade 3        ");
        else if (arr [i + 26] == 4)
            printf ("spade 4        ");
        else if (arr [i + 26] == 5)
            printf ("spade 5        ");
        else if (arr [i + 26] == 6)
            printf ("spade 6        ");
        else if (arr [i + 26] == 7)
            printf ("spade 7        ");
        else if (arr [i + 26] == 8)
            printf ("spade 8        ");
        else if (arr [i + 26] == 9)
            printf ("spade 9        ");
        else if (arr [i + 26] == 10)
            printf ("spade 10       ");
        else if (arr [i + 26] == 11)
            printf ("spade J        ");
        else if (arr [i + 26] == 12)
            printf ("spade Q        ");
        else if (arr [i + 26] == 13)
            printf ("spade K        ");
        else if (arr [i + 26] == 14)
            printf ("heart A        ");
        else if (arr [i + 26] == 15)
            printf ("heart 2        ");
        else if (arr [i + 26] == 16)
            printf ("heart 3        ");
        else if (arr [i + 26] == 17)
            printf ("heart 4        ");
        else if (arr [i + 26] == 18)
            printf ("heart 5        ");
        else if (arr [i + 26] == 19)
            printf ("heart 6        ");
        else if (arr [i + 26] == 20)
            printf ("heart 7        ");
        else if (arr [i + 26] == 21)
            printf ("heart 8        ");
        else if (arr [i + 26] == 22)
            printf ("heart 9        ");
        else if (arr [i + 26] == 23)
            printf ("heart 10       ");
        else if (arr [i + 26] == 24)
            printf ("heart J        ");
        else if (arr [i + 26] == 25)
            printf ("heart Q        ");
        else if (arr [i + 26] == 26)
            printf ("heart K        ");
        else if (arr [i + 26] == 27)
            printf ("diamond A      ");
        else if (arr [i + 26] == 28)
            printf ("diamond 2      ");
        else if (arr [i + 26] == 29)
            printf ("diamond 3      ");
        else if (arr [i + 26] == 30)
            printf ("diamond 4      ");
        else if (arr [i + 26] == 31)
            printf ("diamond 5      ");
        else if (arr [i + 26] == 32)
            printf ("diamond 6      ");
        else if (arr [i + 26] == 33)
            printf ("diamond 7      ");
        else if (arr [i + 26] == 34)
            printf ("diamond 8      ");
        else if (arr [i + 26] == 35)
            printf ("diamond 9      ");
        else if (arr [i + 26] == 36)
            printf ("diamond 10     ");
        else if (arr [i + 26] == 37)
            printf ("diamond J      ");
        else if (arr [i + 26] == 38)
            printf ("diamond Q      ");
        else if (arr [i + 26] == 39)
            printf ("diamond K      ");
        else if (arr [i + 26] == 40)
            printf ("club A         ");
        else if (arr [i + 26] == 41)
            printf ("club 2         ");
        else if (arr [i + 26] == 42)
            printf ("club 3         ");
        else if (arr [i + 26] == 43)
            printf ("club 4         ");
        else if (arr [i + 26] == 44)
            printf ("club 5         ");
        else if (arr [i + 26] == 45)
            printf ("club 6         ");
        else if (arr [i + 26] == 46)
            printf ("club 7         ");
        else if (arr [i + 26] == 47)
            printf ("club 8         ");
        else if (arr [i + 26] == 48)
            printf ("club 9         ");
        else if (arr [i + 26] == 49)
            printf ("club 10        ");
        else if (arr [i + 26] == 50)
            printf ("club J         ");
        else if (arr [i + 26] == 51)
            printf ("club Q         ");
        else
            printf ("club K         ");


        if (arr [i + 39] == 1)
            printf ("spade A        ");
        else if (arr [i + 39] == 2)
            printf ("spade 2        ");
        else if (arr [i + 39] == 3)
            printf ("spade 3        ");
        else if (arr [i + 39] == 4)
            printf ("spade 4        ");
        else if (arr [i + 39] == 5)
            printf ("spade 5        ");
        else if (arr [i + 39] == 6)
            printf ("spade 6        ");
        else if (arr [i + 39] == 7)
            printf ("spade 7        ");
        else if (arr [i + 39] == 8)
            printf ("spade 8        ");
        else if (arr [i + 39] == 9)
            printf ("spade 9        ");
        else if (arr [i + 39] == 10)
            printf ("spade 10       ");
        else if (arr [i + 39] == 11)
            printf ("spade J        ");
        else if (arr [i + 39] == 12)
            printf ("spade Q        ");
        else if (arr [i + 39] == 13)
            printf ("spade K        ");
        else if (arr [i + 39] == 14)
            printf ("heart A        ");
        else if (arr [i + 39] == 15)
            printf ("heart 2        ");
        else if (arr [i + 39] == 16)
            printf ("heart 3        ");
        else if (arr [i + 39] == 17)
            printf ("heart 4        ");
        else if (arr [i + 39] == 18)
            printf ("heart 5        ");
        else if (arr [i + 39] == 19)
            printf ("heart 6        ");
        else if (arr [i + 39] == 20)
            printf ("heart 7        ");
        else if (arr [i + 39] == 21)
            printf ("heart 8        ");
        else if (arr [i + 39] == 22)
            printf ("heart 9        ");
        else if (arr [i + 39] == 23)
            printf ("heart 10       ");
        else if (arr [i + 39] == 24)
            printf ("heart J        ");
        else if (arr [i + 39] == 25)
            printf ("heart Q        ");
        else if (arr [i + 39] == 26)
            printf ("heart K        ");
        else if (arr [i + 39] == 27)
            printf ("diamond A      ");
        else if (arr [i + 39] == 28)
            printf ("diamond 2      ");
        else if (arr [i + 39] == 29)
            printf ("diamond 3      ");
        else if (arr [i + 39] == 30)
            printf ("diamond 4      ");
        else if (arr [i + 39] == 31)
            printf ("diamond 5      ");
        else if (arr [i + 39] == 32)
            printf ("diamond 6      ");
        else if (arr [i + 39] == 33)
            printf ("diamond 7      ");
        else if (arr [i + 39] == 34)
            printf ("diamond 8      ");
        else if (arr [i + 39] == 35)
            printf ("diamond 9      ");
        else if (arr [i + 39] == 36)
            printf ("diamond 10     ");
        else if (arr [i + 39] == 37)
            printf ("diamond J      ");
        else if (arr [i + 39] == 38)
            printf ("diamond Q      ");
        else if (arr [i + 39] == 39)
            printf ("diamond K      ");
        else if (arr [i + 39] == 40)
            printf ("club A         ");
        else if (arr [i + 39] == 41)
            printf ("club 2         ");
        else if (arr [i + 39] == 42)
            printf ("club 3         ");
        else if (arr [i + 39] == 43)
            printf ("club 4         ");
        else if (arr [i + 39] == 44)
            printf ("club 5         ");
        else if (arr [i + 39] == 45)
            printf ("club 6         ");
        else if (arr [i + 39] == 46)
            printf ("club 7         ");
        else if (arr [i + 39] == 47)
            printf ("club 8         ");
        else if (arr [i + 39] == 48)
            printf ("club 9         ");
        else if (arr [i + 39] == 49)
            printf ("club 10        ");
        else if (arr [i + 39] == 50)
            printf ("club J         ");
        else if (arr [i + 39] == 51)
            printf ("club Q         ");
        else
            printf ("club K         ");


        putchar('\n');

        }

    putchar('\n');
    getchar ();


    return 0;

}