IDK whats wrong...? Help please
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
#include <iostream>
#include <ctime>
#include <algorithm>
using namespace std;
class Deck
{
public:
int cards[52];
void set()
{
int x = 1;
for (int i = 0; i < 52; i++, x++)
{
if (x == 14)
x = 1;
cards[i] = x;
}
random_shuffle(cards[0], cards[52]);
}
void shuffle()
{
random_shuffle(cards[0], cards[52]);
}
void print()
{
for (int i = 0; i < 52; i++)
cout << cards[i] << " ";
}
};
int main()
{
Deck deck;
deck.set();
deck.print();
system("pause");
}
|
Fixed it... :) The random_shuffle paramters needed to be passed by reference
Topic archived. No new replies allowed.