What I have to do is store a randomly selected pair of characters in a matrix and print it like this.
? # ¡ x
x ? # ¡
0 - + *
+ 0 - *
The problem is that I can not find a way to mark the characters that have come out twice, so as not to include them anymore.
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
char a[4][4];
char cartas[]={'#','%','@','0','*','!','<','x'};
int total=sizeof(cartas);
int main()
{
srand(time(0));
for (int i=0;i<4;i++)
{
for (int j=0;j<4;j++)
{
a[i][j]=cartas[rand()%total];
printf("\t%c",a[i][j]);
}
printf("\n\n");
}
}
Does anyone know any way?