im working a card program that will shuffel and display the cards. im trying to randomize numbers but this code will not print anything. it seems like it goes into an endless loop.
for(int g=0; g<52; g++)
{
do
{
card1 = rand() % 52;
for(int d=0; d<52; d++)
{
if(card_array[d]==card1)
counter++;
}
if (counter > 4)
{
u=0;
}
else if (counter < 4)
{
card_array[g] = card1;
u=1;
}
}while(u==0);
cout << card1 <<endl;
}
any help would be good.