Originariamente inviato da AntoKr
scusate se le righe non sono ben tabulate, ma copiando e incollando, le tabulazioni sono andate perse...
Magia!
codice:
void disegnaschema(char x[][dim])
{
int s=0;
srand(time(0));
for(int i=0; i<dim; i++)
for(int j=0; j<dim; j++)
{
if(i==0)
{
if(j==0)
x[i][j]=201; //ANGOLO SUPERIORE SX
else if(j==dim-1)
x[i][j]=187; //ANGOLO SUPERIORE DX
else
x[i][j]=205; //MARGINE SUPERIORE
}
else if(i==dim-1)
{
if(j==0)
x[i][j]=200; //ANGOLO INFERIORE SX
else if(j==dim-1)
x[i][j]=188; //ANGOLO INFERIORE DX
else
x[i][j]=205; //MARGINE INFERIORE
}
else
{
if(i==1 && j==0)
x[i][j]='E'; //ASSEGNA ENTRATA
else if(i==dim-2 && j==dim-1)
x[i][j]='U'; //ASSEGNA USCITA
else if(j==0 || j==dim-1)
x[i][j]=186; //MARGINI LATERALI
else
{
s=rand()%2;
if(s==0 && x[i][j]!=' ')
x[i][j]=' ';
else if(s==1 && x[i][j]!=' ')
x[i][j]=186;
}
}
}
}