Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. typedef struct {
  2. char nome[25];
  3. int matricula;
  4. float notas[2];
  5. char situacao[10];
  6. } Aluno;
  7.  
  8. Aluno Alunos[N_ALUNOS];
  9.  
  10. int alunosCadastrados = 0;
  11.  
  12. void atualizaArray(int posExcluida){
  13. // Se a posição excluida não for a última
  14. if(posExcluida < alunosCadastrados - 1){
  15. // Percorre todo vetor
  16. for(int j = 0; j < alunosCadastrados; j++){
  17. // se o índice atual for maior que a posição excluida do vetor
  18. if(j > posExcluida){
  19. Alunos[j - 1].matricula = Alunos[j].matricula;
  20. strcpy(Alunos[j - 1].situacao, Alunos[j].situacao);
  21. Alunos[j - 1].notas[0] = Alunos[j].notas[0];
  22. Alunos[j - 1].notas[1] = Alunos[j].notas[1];
  23. strcpy(Alunos[j - 1].nome, Alunos[j].nome);
  24. }
  25. }
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement