c# 오늘의 공부 : 배열, 어레이.

////2차원 배열

//using System;

//namespace _2DArray
//{
//    class MainApp
//    {
//        static void Main(string[] args)
//        {
//            int[,] arr = new int[2, 3] { { 1, 2, 3 }, { 4, 5, 6 } };

//            for (int i = 0; i < arr.GetLength(0); i++)
//            {
//                for (int j = 0; j < arr.GetLength(1); j++)
//                {
//                    Console.Write("[{0},{1}] : {2}", i, j, arr[i, j]);
//                                    }
//                Console.WriteLine();
//            }
//            Console.WriteLine();

//            int[,] arr2 = new int[,] { { 1, 2, 3 }, { 4, 5, 6 } };

//            for (int i = 0; i < arr2.GetLength(0); i++)
//            {
//                for (int j = 0; j < arr2.GetLength(1); j++)
//                {
//                    Console.Write("[{0},{1}] : {2}" , i,j,arr2[i,j]);
//                }
//                Console.WriteLine();
//            }
//            Console.WriteLine();

//            int[,] arr3 = new int[,] { { 1, 2, 3 }, { 4, 5, 6 } };
//            for (int i = 0; i < arr3.GetLength(0); i++)
//            {
//                for (int j = 0; j < arr3.GetLength(1); j++)
//                {
//                    Console.Write("[{0},{1}] : {2}", i, j, arr3[i, j]);
//                }
//                Console.WriteLine();
//            }
//            Console.WriteLine();
//        }
//    }
//}

////다차원 배열

//using System;

//namespace _3DArray
//{
//    class jpcorp
//    {
//        static void Main(string[] args)
//        {
//            int[,,] array = new int[4,3,2]
//            {
//                {{1,2},{3,4},{5,6}},
//                {{1,4},{2,5},{3,6}},
//                {{6,5},{4,3},{2,1}},
//                {{6,3},{5,2},{4,1}},
//            };

//            for (int i = 0; i < array.GetLength(0); i++)
//            {
//                for (int j = 0; j < array.GetLength(1); j++)
//                {
//                    Console.Write("{");
//                    for (int k = 0; k < array.GetLength(2); k++)
//                    {
//                        Console.Write("{0}", array[i, j, k]);
//                    }
//                    Console.Write("} “);

//                }
//                Console.WriteLine();
//            }

//        }
//   }
//}

//// 가변 배열
//using System;

//namespace JaggedArray
//{
//    class jpcorp
//    {
//        static void Main(string[] args)
//        {
//            int[][] jagged = new int[3][];
//            jagged[0] = new int[5] { 1, 2, 3, 4, 5 };
//            jagged[1] = new int[] { 10, 20, 30 };
//            jagged[2] = new int[] { 100, 200 };

//            foreach (int[] arr in jagged)
//            {
//                Console.Write(“Length:{0}, “, arr.Length);
//                foreach (int e in arr)
//                {
//                    Console.Write("{0} “, e);
//                }
//                Console.WriteLine(””);               
//            }
//            Console.WriteLine(””);

//            int[][] jagged2 = new int[2][]
//            {
//                new int []{1000,2000,},
//                new int [4]{6,7,8,9},
//            };

//            foreach (int[] arr in jagged2)
//            {
//                Console.Write(“Length:{0}, “,arr.Length);
//                foreach( int e in arr)
//                {
//                    Console.Write("{0} “,e);
//                }
//                Console.WriteLine();
//            }
//        }
//    }
//}

////컬렉션
////Arraylist

//using System;
//using System.Collections;

//namespace UsingList
//{
//    class jpcorp
//    {
//        static void Main(string[] args)
//        {
//            ArrayList list = new ArrayList();
//            for (int i = 0; i < 5; i++)
//                list.Add(i);

//            foreach (object obj in list)
//                Console.Write("{0} “, obj);
//            Console.WriteLine();

//            list.Remove(2);

//            foreach (object obj in list)
//                Console.Write("{0} “, obj);
//            Console.WriteLine();

//            list.Insert(2, 2);

//            foreach (object obj in list)
//                Console.Write("{0} “, obj);
//            Console.WriteLine();

//            list.Add(“abc”);
//            list.Add(“def”);

//            for (int i = 0; i < list.Count; i++)
//                Console.Write("{0} “, list[i] );
//            Console.WriteLine();

//        }
//    }
//}

////Queue
//using System;
//using System.Collections;

//namespace UsingQueue
//{
//    class jpcorp
//    {
//        static void Main(string[] args)
//        {
//            Queue que = new Queue();
//            que.Enqueue(1);
//            que.Enqueue(2);
//            que.Enqueue(3);
//            que.Enqueue(4);
//            que.Enqueue(5);

//            while (que.Count > 0)
//                Console.WriteLine(que.Dequeue());
//        }
//    }
//}

////stack 컬렉션

//using System;
//using System.Collections;

//namespace UsingStack
//{
//    class jpcorp
//    {
//        static void Main(string[] args)
//        {
//            Stack stack = new Stack();
//            stack.Push(1);
//            stack.Push(2);
//            stack.Push(3);
//            stack.Push(4);
//            stack.Push(5);

//            while (stack.Count > 0)
//                Console.WriteLine(stack.Pop());
//        }
//    }
//}

////hashtable
//using System;
//using System.Collections;

//namespace UsingHashtable
//{
//    class jpcorp
//    {
//        static void Main(string[] args)
//        {
//            Hashtable ht = new Hashtable();
//            ht[“하나”] = “one”;
//            ht[“둘”] = “two”;
//            ht[“셋”] = “three”;
//            ht[“넷”] = “four”;
//            ht[“다섯”] = “five”;

//            Console.WriteLine(ht[“하나”]);
//            Console.WriteLine(ht[“둘”]);
//            Console.WriteLine(ht[“셋”]);
//            Console.WriteLine(ht[“넷”]);
//            Console.WriteLine(ht[“다섯”]);
//        }
//    }
//}

Hugo로 만듦
JimmyStack 테마 사용 중