Yurttas/PL/OOL/CS/F/05/01/02/Arrays00.cs

From ZCubes Wiki
Jump to navigation Jump to search
 1/**
 2 *  Copyright(C) 2003
 3 *  All Rights Reserved. Salih Yurttas, ZCubes, BitsOfCode Software Systems, Inc..
 4 *
 5 *  Permission to use, copy, modify, and distribute this
 6 *  software and its documentation for EDUCATIONAL purposes
 7 *  and without fee is hereby granted provided that this
 8 *  copyright notice appears in all copies.
 9 *
10 *  @date   : September 1, 2003
11 *  @author : Salih Yurttas
12 *
13 *  Arrays00.cs
14 */
15
16
17using System;
18
19namespace ABC
20{
21  public class Arrays00
22  {
23    public static void Main(string[] args)
24    {
25      int M = 2;
26      int N = 4;
27      int[,] A2;
28
29      A2 = new int[M,N];
30      for(int i=0; i<M; ++i)
31        for(int j=0; j<N; ++j)
32          A2[i,j] = i;
33
34      M = A2.GetLength(0);
35      N = A2.GetLength(1);
36
37      for(int i=0; i<M; ++i)
38      {
39        for(int j=0; j<N; ++j)
40        {
41          Console.Write(A2[i,j]);
42          Console.Write("  ");
43        }
44        Console.WriteLine();
45      }
46    }
47  }
48}