1. ## my lost loop

Ok, this might look familiar. I posted this code awhile ago and I was told I had an infinate loop in it. After some time of trying to revise the code, I cannot fix the problem on my own. The problem should be in the randomnumber function. I hope you can help me.

Code:
```/*Epsilon Omega Gamma*/
#ifndef _epsilonomegagamma_h
#define _epsilonomegagamma_h

void dealcomp(int number);
void dealme(int number);
bool showcomp(bool isgameover);
void showme();
void blackjack();
int randnumber();
int randnumber1;
void newround();
bool compturn();
bool myturn();
short comphand[11];
int comphandsize, comphandvalue, compace;
int myhand[11], myhandsize, myhandvalue, myace, cardsleft;
int i;
char hiddencard;
int start();
int number;
bool continuegame1;
bool continuegame2;
void start1();
bool isgameover;
char newgame;

void blackjack()
{
cardsleft=52;
hiddencard=2;
for (i=0; i<11; i++)
{
comphand[i]=0;
myhand[i]=0;
}
}
int randnumber()
{
static bool card[52];
if(cardsleft==52)
{
for(i=0; i<52; i++)
{
card[i]=1;
}
}
randnumber1=rand()%52;

cardsleft--;
card[randnumber1]=false;
return (randnumber1%13)+1;
}
void newround()
{
bool continue1=true, continue2=true, over=false;
compace=0, comphand[11]=0, myace=0, myhand[11]=0;
for(i=0; i<11; i++)
{
comphand[i]=0;
myhand[i]=0;
}
cardsleft=52;
dealcomp(2);
showcomp(false);
dealme(2);
showme();
if(comphand[11]==21||myhand[11]==21)
{
continuegame1=false, continuegame2=false;
}
while((continuegame1||continuegame2) && comphand[11] < 22 && myhand[11] <22)
{
continuegame1=compturn();
if(continuegame1||continuegame2)
{
continuegame2=myturn();
}
}
cout<<endl;
}
void dealcomp(int number)
{
for( ; number; number--)
{
int newcard = randnumber();
comphand[comphandsize] = newcard;
comphandsize++;
if(newcard == 1 && comphandvalue <=10)
{
compace++;
comphandvalue +=11;
}
else if(newcard > 10)
{
comphandvalue +=10;
}
else
{
comphandvalue += newcard;
}
if(comphandvalue > 21 && compace)
{
compace--;
comphandvalue -=10;
}
}
}
void dealme(int number)
{
for( ; number; number--)
{
int newcard=randnumber();
myhand[myhandsize]=newcard;
myhandsize++;
if(newcard == 1 && myhandvalue <=10)
{
myace++;
myhandvalue +=11;
}
else if(newcard >10)
{
myhandvalue +=10;
}
else
{
myhandvalue +=newcard;
}
if(myhandvalue >21 && myace)
{
myace--;
myhandvalue -=10;
}
}
}
bool compturn()
{
if(comphandvalue < 17 && compace || comphandvalue < 17)
{
cout<<"I will take a card."<<endl;
dealcomp(1);
showcomp(false);
return true;
}
cout<<"I'm not taking a card."<<endl;
return false;
}
bool myturn()
{
cout<<"Do you want a card? y = yes, n = no."<<endl;
while(1)
{
{
case 'y':
case 'Y': cout<<"You take a card: "<<endl;
dealme(1);
return true;
case 'n':
case 'N': return false;
default: cout<<endl<<"Huh? Do you want another card or not. y = yes, n = no."<<endl<<" >"<<endl;
break;
}
}
}
bool showcomp(bool isgameover)
{
cout<<"My hand is: ";
if(!isgameover)
{
cout<<hiddencard<<" ";
}
for( int i = !isgameover; comphand[i] !=0; i++)
{
switch (comphand[i])
{
case 1: cout<<"A ";
break;
case 11: cout<<"J ";
break;
case 12: cout<<"Q ";
break;
case 13: cout<<"K ";
break;
default: cout<<comphand[i]<<" ";
break;
}
}
cout<<endl;
return isgameover;
}
void showme()
{
for( int i =0; myhand[i] !=0; i++)
{
switch (myhand[i])
{
case 1: cout<<" A ";
break;
case 11: cout<<" J ";
break;
case 12: cout<<" Q ";
break;
case 13: cout<<" K ";
break;
default: cout<<myhand[i]<<" ";
break;
}
}
cout<<endl;
}
void start1()
{
blackjack();
randnumber();
newround();

compturn();
myturn();
showcomp(isgameover);
showme();
}

int Start()
{
srand(time(0));
cout<<"\nBlackjack. Wanna play? y = yes, n = no.\n>";
cin>>newgame;
cout<<endl;
while((newgame =='y') || (newgame =='Y'))
{
switch(newgame)
{
case 'y': start1();
case 'Y': start1();
break;
case 'n': break;
case 'N': break;
default: cout<<endl<<"Huh? Do you wanna play Blackjack? y = yes, n = no"<<endl<<">";
cin>>newgame;
break;
}
}
cout<<"Have a nice day!"<<endl;
return 0;
}
#endif```

2. Initialize variable cardsleft to 52;

cardsleft = 52;

Kuphryn