#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#define N_ALUNOS 5

typedef struct {
    char nome[25];
    int matricula;
    float notas[2];
    char situacao[10];
} Aluno;

Aluno Alunos[N_ALUNOS];

int alunosCadastrados = 0;

void atualizaArray(int posExcluida){
    if(posExcluida >= 0 &&  posExcluida < alunosCadastrados - 1){
        for(int j = posExcluida; j < alunosCadastrados - 1; j++){
            Alunos[j].matricula = Alunos[j + 1].matricula;
            strcpy(Alunos[j].situacao, Alunos[j + 1].situacao);
            Alunos[j].notas[0] = Alunos[j + 1].notas[0];
            Alunos[j].notas[1] = Alunos[j + 1].notas[1];
            strcpy(Alunos[j].nome, Alunos[j + 1].nome);
        }
    	alunosCadastrados--;
    }
}

void mostrarAlunos(){
    for (int i = 0;i < alunosCadastrados;++i){
        printf("%d - %s, %d, %f, %f, %s\n", i, Alunos[i].nome, Alunos[i].matricula, Alunos[i].notas[0], Alunos[i].notas[1], Alunos[i].situacao);
    }
}

void inserirAluno(char *nome, int matricula, float nota1, float nota2, char *situacao){
    strcpy(Alunos[alunosCadastrados].nome, nome);
    Alunos[alunosCadastrados].matricula = matricula;
    Alunos[alunosCadastrados].notas[0] = nota1;
    Alunos[alunosCadastrados].notas[1] = nota2;
    strcpy(Alunos[alunosCadastrados].situacao, situacao);
    alunosCadastrados++;
}

int main() {

    inserirAluno("Carlos", 1234, 10.0f, 12.0f, "aprovado");
    inserirAluno("Sofia", 5678, 19.0f, 14.0f, "aprovada");
    inserirAluno("Manuel", 4894, 7.0f, 9.0f, "reprovado");
    inserirAluno("Cristina", 9156, 5.0f, 11.0f, "reprovada");
    mostrarAlunos();
    printf("\nDepois da remover:\n");

    atualizaArray(0);
    mostrarAlunos();

    return 0;
}
