I'm trying to make a shuffler for a blackjack program it's supposed to give me back a random number from a deck of cards each time i call it. But it's also supposed to keep track of cards out of the deck..
I need to make it a function call, but before i do that it's not even working in the first place... it's giving me 51 random crazy numbers..
help please?
#include <iostream>
using std::cout;
using std::cin;
using std::endl;
#include <cstdlib>
using std::rand;
using std::srand;
#include <ctime>
using std::time;
//int random();
int main()
{//begin main
srand(time(0));
int deck[52];
//int random()
//{
for (int i=0; i<51; i++)
{
int j = rand() % (51 - i) + i + 1;
int t = deck[i];
deck[i] = deck[j];
deck[j] = t;
//return t;
//}
cout << t << endl;
}
//randomize the time
//int cardval = random();
system("pause");
return 0;
}//end main