Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int busca( int mat[][MAX],int n, int m, int N, float vetor[])
- {
- int i,j,k,aux;
- for(k=0;k<N;k++)
- {
- printf("Informe o valor do %d vetor:", k+1 ); // le o vetor
- scanf("%f",&vetor[k]);
- }
- for (i =0; i < n ;i ++)
- {
- for ( j = 0; j < m ;j ++)
- {
- printf ("Digite mat [%d][%d]: ",i , j) ; //le a matriz
- scanf ("%d",&mat [i][j]) ;
- }
- }
- //aqui seria a logica pra achar o elemento igual
- for(i=0; i<n;i++)
- {
- for(j=0;j<m;j++)
- {
- if(mat[i][j] == vetor[k])
- {
- return i;
- }
- }
- }
- if (i>=0)
- printf(" A primeira ocorrencia do vetor eh na linha %dn.",i-1 );
- else
- return -1;
- }
Add Comment
Please, Sign In to add comment