Exemple d’un tableau à plusieurs dimensions

Author:

ArrayList, Array, HashTable, BitArray
{filelink=18424}

using System;

class TabProp
{
    static void Main(String[] args)
    {
        int[,] tabBinaire = new int[8, 8];
        for (int i = 0; i < tabBinaire.GetLength(0); i++)
        {
            for (int x = 0; x < tabBinaire.GetLength(1); x++)
            {
                if ((x % 2) == 0)
                    if ((i % 2) == 0)
                        tabBinaire[i, x] = 0;
                    else
                        tabBinaire[i, x] = 1;
                else
                    if ((i % 2) == 0)
                        tabBinaire[i, x] = 1;
                    else
                        tabBinaire[i, x] = 0;
            }
        }

        for (int i = 0; i < tabBinaire.GetLength(0); i++) {
            for (int x = 0; x < tabBinaire.GetLength(1); x++) {
                Console.Write(tabBinaire[i, x]);
            }
            Console.WriteLine();
        }
    }
}

Leave a Reply

Your email address will not be published. Required fields are marked *