Advertisement
Guest User

Untitled

a guest
Oct 31st, 2014
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.94 KB | None | 0 0
  1. #include<stdio.h>
  2.  
  3. typedef struct Aluno
  4.     {
  5.         int matricula;
  6.         char* nome;
  7.         int idade;
  8.     } Aluno;
  9.  
  10. void inserirPosicao(Aluno L[],Aluno x,int n,int i)
  11. {
  12.     int j;
  13.     for (j=n; j>=i; j--)
  14.     {
  15.         L[j+1]= L[j];
  16.     }
  17.  
  18.     L[i] = x;
  19.     n++;
  20. }
  21.  
  22. void inserir(Aluno L[], int N,Aluno x)
  23. {
  24.     int i;
  25.     int PosIns;
  26.    
  27.     //eduardo quando sua busca estiver pronte descomente aqui e retire o i = -1
  28.     //i = Busca(L, N, x.matricula,&PosIns);
  29.     i = -1;
  30.     //se i = 0, nao existe registro com a matricula dada, ou seja, ela e inserida na ordem ja
  31.     if(i == -1)
  32.     {
  33.         inserirPosicao(L, x, N, PosIns);
  34.     }  
  35.     else
  36.     {
  37.         printf("Chave existente");
  38.     }
  39. }
  40.  
  41.  
  42. int main(){
  43.         int n = 0;
  44.     //int busca = 10;
  45.     int tamVet = 1000;
  46.         int PosIns;
  47.         //scanf("%d",&tamVet);
  48.         Aluno aluno;
  49.         Aluno L[tamVet];
  50.         inserir(L,n,aluno);
  51.         //busca = Busca(L,n,aluno,&PosIns);
  52.  
  53.         //printf("%d",PosIns);
  54.         //printf("%d",busca);
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement