jeudi 23 avril 2020

Make a number in an array a card value

So what I'm trying to do here is make deck[0], deck[1], deck[2], etc be equal to let's say 1 D(with 1 as value),2 D(with 2 as value),3 D(with 3 as value), etc. Is there any way to do this with a simple code? I don't mind if I have to do many if statements for example. I just can't figure a way to do it.

int main()
{
    int suit;
    int face;
    int deck[52] = { 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 };

    char suit[4] = { 'D','H','C','S' };

    int face[13] = { 1,2,3,4,5,6,7,8,9,10,10,10,10 };

    for (int count = 0; count < 52; count++) {
        face = deck[count] % 13;
        suit = deck[count] / 13;
    }



    return 0;
}

Aucun commentaire:

Enregistrer un commentaire