Storing information about students

Asked

Viewed 55 times

0

I need to develop a program platform WINDOWS where it will be stored information about students of the kind: age, gang, shift and name. The program must also contain a search for name. I would like suggestions.

  • 1

    Welcome to Stackoverflowpt. I recommend you edit your question and provide more details regarding your questions. The community is always willing to help, but we have to see an effort from you. Here we do not do college work.

1 answer

1


You may be creating a structure vector.

#define MAX_ALUNOS 50

struct Alunos
{
    std::string Nome;
    unsigned int idade;

    std::string turma;
    std::string turno;
};

std::vector<Alunos> Hypnos_Alunos(MAX_ALUNOS);

And in the search, you may be creating a function who receives a string with the student’s name.

void Buscar_Por_Aluno(std::string NOME)
{
    for (int x = 0; x < MAX_ALUNOS; x++)
    {       
        if (Hypnos_Alunos[x].Nome.compare(NOME) == 0)
        {
            // Listando dados do aluno encontrado
            std::cout << "Nome: " << Hypnos_Alunos[x].Nome << std::endl;
            std::cout << "Idade: " << Hypnos_Alunos[x].idade << std::endl;
            std::cout << "Turma: " << Hypnos_Alunos[x].turma << std::endl;
            std::cout << "Turno: " << Hypnos_Alunos[x].turno << std::endl;
        }
    }
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.