开发者

BlackJack cards vector c++/random numbers

开发者 https://www.devze.com 2023-02-05 07:06 出处:网络
I followed some of the answers here on the site but I still have a problem: after I generate my vector of cards when I run the program the card numbers are totally off:

I followed some of the answers here on the site but I still have a problem: after I generate my vector of cards when I run the program the card numbers are totally off: first card:100 second card:22 third:0 fourth:0 fifth:28 etc.

This is my code:

    enum numar {AS=11 ,DOI=2, TREI=3, PATRU=4, CINCI=5, SASE=6, SAPTE=7, OPT=8,
NOUA=9, ZECE=10, VALET=10,开发者_StackOverflow DAMA=10, REGE=10,
PrimulNumar=AS, UltimulNumar=REGE};
enum culoare {INIMA, CAROU, NEGRU, TREFLA, PrimaCuloare=INIMA,
UltimaCuloare=TREFLA};



 int k=0;
        for (int r = PrimulNumar; r <= UltimulNumar; ++r) {
                for (int s = PrimaCuloare; s <= UltimaCuloare; s++) {
                        pc[k]= new Carte((numar)r, (culoare)s, false);
                        k++;

What should I do?


So...replacing enums with values:

int k = 0;
for (int r = 11; r <= 10; ++r)
  for (int s = 0; s <= 3; ++s
  {
  }

See the problem?

0

精彩评论

暂无评论...
验证码 换一张
取 消