Guest User

Untitled

a guest
May 20th, 2018
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.73 KB | None | 0 0
  1. vetorB[i] = 30 + ( rand() % 70 );
  2.  
  3. printf("%d, ",vetorA[i]);
  4.  
  5. printf("Elementos de B:{ ");
  6.  
  7. printf("%d, ",vetorB[i]);
  8.  
  9. if (vetorA[i] == vetorB[a])
  10. {
  11.  
  12. tamVetor++;
  13.  
  14. vetorIn[c] = vetorA[i];
  15. vetorR[c] = a; //guarda os indices dos elementos do vetorB que tambem estao no vetorA
  16. c++;
  17.  
  18. }//fecha o if
  19.  
  20.  
  21.  
  22. }// fecha for de dentro
  23. }//fecha o for de fora
  24.  
  25. printf(" tamanho do vetor e: %dn", tamVetor);
  26.  
  27. printf("Os elementos da Intersecao entre A e B sao: { ");
  28.  
  29. for(int i = 0; i < tamVetor; i++)
  30. {
  31. printf("%d, ", vetorIn[i]);
  32.  
  33. }
  34.  
  35. printf("}n");
  36.  
  37. tamVetorU++;
  38.  
  39.  
  40. vetorU = realloc(vetorU,sizeof(int*)*tamVetorU);
  41.  
  42. if (i == vetorR[c])
  43. {
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50. }
  51. else
  52.  
  53. vetorU = realloc(vetorU,sizeof(int*)*tamVetorU);
  54.  
  55. Conjuntos();
  56.  
  57. return 0;
Add Comment
Please, Sign In to add comment