I need to create a function that is in a .h file that generates random numbers n (user-defined and passed by parameter in function), and fill the set b with the generated values.
tConj.cpp file
TConj a,b,c,d;
int elemento, i,op;
long unsigned num;
if (op==6){
int num;
printf("Quantidade de elementos a ser gerado: ");
scanf("%d",&num);
b = GerarConjunto(num);
}
TConj.h file
struct TConj{
int * elemento;
int n;
};
TConj GerarConjunto(int n){
TConj vet;
vet.elemento = (int *) malloc(10*sizeof(int));
int var;
for (int i=0;i<n;i++){
srand(time(NULL));
var = rand()%n;
vet.elemento[i] = var;
}
return vet;
}