samedi 17 janvier 2015

input random matrix with only " * " and " SPACE "

i know how to set a range but the * and SPACE are between 32 and 42 .. and i need only either one of them to input in my matrix.



{
int i,j;
char matrix[SIZE][SIZE],c;
srand(time(NULL));
for (i=0;i<SIZE;i++)
{
for (j=0;j<SIZE;j++)
{
c=(rand()%32) || (rand()%42);
matrix[i][j]=c;
printf("%3c", matrix[i][j]);
}
printf("\n");
}




Aucun commentaire:

Enregistrer un commentaire