Print all playing cards (Java)

-7

Hello.

I'm trying to create a program that prints all 52 cards in the deck, from 1 to 10 and with all suits (Clubs, Diamonds, Hearts, Swords) and also prints the cards Jack, Lady and King. >

I found the use of the "for" more appropriate in this case, however I do not have much knowledge with repetitive functions, I would like to know how to print a "String" using "for"?

I am using this logic but it is not practical, as I would have to create a "for" for each number, I need a logic that simplifies this.

    for (int i = 1; i <= 10; ++i) {
        System.out.println(i  +  " De Paus");
    }

    }
}
    
asked by anonymous 17.10.2018 / 20:01

1 answer

0

I do not know if it was time to copy here, but it has many date brackets there.

I would recommend studying arrays, think of them as a set of variables, instead of having an int value in the variable you have an array of 13 ints within that array.

You can have an array of suits and then use for to do what you did, or an array of suits, each item being another array for the cards.

Then you can go through this array (we call it iterate in the array) to print.

Follow a link with an initial reference for you to build on, content from DevMidia

    
17.10.2018 / 20:12