using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Arrays
{
    class Examples19_21
    {
        public static void CreateJaggedArray()
        {
            // Listing 5-19
            int[][] arrays = new int[5][]
            {
                new[] { 1, 2 },
                new[] { 1, 2, 3, 4, 5, 6 },
                new[] { 1, 2, 4 },
                new[] { 1 },
                new[] { 1, 2, 3, 4, 5 }
            };

            Console.WriteLine(arrays[2][2]);
        }

        public static void CreateRectangularArray()
        {
            // Listing 5-20
            int[,] grid = new int[5, 10];
            var smallerGrid = new int[,]
            {
                { 1, 2, 3, 4 },
                { 2, 3, 4, 5 },
                { 3, 4, 5, 6 },
            };

            Console.WriteLine(smallerGrid[1, 3]);
        }

        public static void CreateCuboidArray()
        {
            // Listing 5-21
            var cuboid = new int[,,]
            {
                {
                    { 1, 2, 3, 4, 5 },
                    { 2, 3, 4, 5, 6 },
                    { 3, 4, 5, 6, 7 }
                },
                {
                    { 2, 3, 4, 5, 6 },
                    { 3, 4, 5, 6, 7 },
                    { 4, 5, 6, 7, 8 }
                },
            };

            Console.WriteLine(cuboid[1, 2, 4]);
        }
    }
}
