using System; namespace TwoDArrayDemo { class Class1 { [STAThread] static void Main(string[] args) { const int X_SIZE = 8; const int Y_SIZE = 8; // Declare the 2-D array of integers. int[,] chessBoard = new int[X_SIZE, Y_SIZE]; // Initialize the array with 0s; for (int i = 0; i <= chessBoard.GetUpperBound(0); ++i) { for (int j = 0; j <= chessBoard.GetUpperBound(1); ++j) { chessBoard[i,j] = 0; } } Print2DArray( chessBoard ); // Fill in some spots. chessBoard[5,5] = 1; chessBoard[0,0] = 1; chessBoard[7,7] = 1; chessBoard[2,1] = 1; chessBoard[1,2] = 1; chessBoard[7,6] = 1; Print2DArray( chessBoard ); // Check to see how many spots are non-zero. // // What... I can't do it ALL for you folks! Give it a shot. } private static void Print2DArray( int[,] someArray ) { for (int i = 0; i <= someArray.GetUpperBound(0); ++i) { Console.Write("Row " + i.ToString() + " - "); for (int j = 0; j <= someArray.GetUpperBound(1); ++j) { Console.Write(someArray[i,j].ToString() + " "); } Console.WriteLine(); } } } }