0
I have a university project that I was asked to create a canteen in which I was asked to create groups of students / staff to add to the queue. Groups can have 1 to 10 members . The problem here is to be able to generate these groups. Students are defined by their first name , last name, student number, group number, limit and course; The staff is defined by its first name, last name , department number, employee number and ceiling; Groups can only contain students or staff, not the two mixed.
I created the following structs:
struct identidade {
struct aluno {
string primeironome;
string ultimonome;
int numero;
string curso;
float plafond;
};
struct staff {
string primeironome;
string ultimonome;
int numero;
float plafond;
};
}; struct group { int numerogroup; identity * persons; };
but here the problem is how to create groups, I developed the following function ( I did only for students , for now)
the names of the identities have to be chosen randomly and the courses also.
void criagrupo(grupo * listaespera, string * pNome, string * uNome, string * cursos) {
int i = rand() % 43; // serve para percorrer os arrays com primeiros nomes
int j = rand() % 96; // serve para percorrer os arrays com ultimos nomes
int k = rand() % 18; // server para percorrer os arrays com os cursos
int tamanho = rand() % 10 + 1;
int dinheiro = rand() % 100 + 1;
int numero = rand() % 20 + 1;
grupo * novogrupo = new grupo;
novogrupo->numerogrupo = numero;
identidade * quantidade = new identidade[tamanho];
for (int i = 0; i < tamanho; i++) {
identidade::aluno * aluno = new identidade::aluno();
aluno->primeironome = pNome[i];
aluno->ultimonome = uNome[j];
aluno->curso = cursos[k];
aluno->plafond = dinheiro;
quantidade[i] = aluno;
};
the function is not yet finished but it occurs to me an error in the amount[i] = student, which I am not able to solve. I would appreciate who could help.