• obosob
    link
    fedilink
    English
    9
    edit-2
    11 months ago

    Yeah, just use a char for card and test

    if(card < '7') count++;
    else count--;
    

    Or something, don’t mix types.

    • @Hexarei
      link
      111 months ago

      The cards should just be numbers, and an enum should be used for display names

      • obosob
        link
        fedilink
        English
        211 months ago

        Chars are just numbers, but yeah, an enum would work fine too, sure. The only advantage with using a char for it is that there’s no conversion needed for outputting them into strings so it’s a little easier. Less code, very readable, etc. Though yeah, thinking about it JQKA wouldn’t be numerically in the right order which could cause issues if the program did more than just implement HiLo

      • obosob
        link
        fedilink
        English
        211 months ago

        I didn’t notice that 7,8,9 had no effect on the count. My bad.