Most elegant representation of a card's rank

bearophile bearophileHUGS at lycos.com
Mon Dec 3 15:42:37 PST 2012


deed:

> How is a playing card's rank represented most elegantly in code?

Maybe with an enum?

enum Card { J, Q, ...}

If you have to store many of them then maybe giving them a size 
of one byte is better:

enum Card : ubyte { Ace, Two, ..., Q, ...}


Bye,
bearophile


More information about the Digitalmars-d-learn mailing list