Generating a Deck of Cards

前端 未结 12 909
暖寄归人
暖寄归人 2020-12-09 06:20

I\'m trying to make a simple blackjack program. Sadly, I\'m having problems right off the bat with generating a deck of cards.

#include 
#inc         


        
12条回答
  •  借酒劲吻你
    2020-12-09 06:50

    Well, first of all, deck[0] is one char, yet you are trying, to stuff "2h" into it. (for the moment, we'll ignore that how you are doing that is wrong.)

    Basically, you'll need to make deck a vector. Make card an array of const char*s, and convert the elements to string.

    then use:

    deck.push_back(std::string(card[j]) + suit[i]);
    

提交回复
热议问题