Advertisement
Hakuhun

átlós keresés

Nov 24th, 2012
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.00 KB | None | 0 0
  1.   public void Átlós()
  2.         {
  3.             int i = 1;
  4.             int j = 1;
  5.             while ((i != tomb.GetLength(0) - 1) && (j != tomb.GetLength(1) -1))
  6.             {
  7.                 for (int a = i-1; a < i+1; a++)
  8.                 {
  9.                     for (int b = j-1; b < j+1; b++)
  10.                     {
  11.                         if (tomb[a, b] == 1)
  12.                         {
  13.                             lehet = false;
  14.                         }
  15.                     }
  16.                     if (lehet == false)
  17.                     {
  18.                         if ((tomb[i, j] == 1) && tomb[i, j + 1] == 1)
  19.                         {
  20.                             db3++;
  21.                         }
  22.                         else if ((tomb[i, j] == 1) && tomb[i, j - 1] == 1)
  23.                         {
  24.                             db3++;
  25.                         }
  26.                     }
  27.                 }
  28.                 i++;
  29.                 j++;
  30.             }
  31.             Console.WriteLine(db3);
  32.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement