Advertisement
Guest User

Exarcício 10 A

a guest
Oct 24th, 2014
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.11 KB | None | 0 0
  1. public void AcontidoEmB(double[] a, double[] b) {
  2.         double aux[] = new double[a.length];
  3.         int k = 0;
  4.         boolean contido=true;
  5.        
  6.         for (int i = 0; i < a.length; i++) {
  7.             boolean marcado = false;
  8.             int j = 0;
  9.             while (j < b.length && marcado != true) {
  10.                 if (a[i] == b[j]) {
  11.                     int percorre = 0;
  12.                     while (percorre < aux.length && marcado != true) {
  13.                         if (aux[percorre] == j) {
  14.                             marcado = true;
  15.                         }
  16.                         percorre++;
  17.                     }
  18.                     if (marcado != true) {
  19.                         aux[k] = j;
  20.                         k++;
  21.                         marcado = true;
  22.                     }
  23.                 }
  24.                 j++;
  25.             }
  26.             if (marcado != true) {
  27.                 contido=false;
  28.             }
  29.         }
  30.         if(contido==true)
  31.             System.out.println("A esta contido em B");
  32.         else
  33.             System.out.println("A não esta contido em B");
  34.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement