/* 2018³â C# ÇÁ·Î±×·¡¹Ö ±â¸» °í»ç Çйø : ¼º¸í : ´ÙÀ½ ÇÁ·Î±×·¥µéÀÇ Ãâ·ÂÀ» ½á¶ó. ÁÖÀÇ »çÇ× (1): ½ÃÇèÁö¿¡ Àý´ë·Î ³«¼­ÇÏÁö ¸»°Í ÁÖÀÇ »çÇ× (2): ¹®Á¦µéÀ» Ç® ¶§ ¸ðµç ÇÁ·Î±×·¥¿¡ ÀÖ´Â data º¯¼öÀÇ °ªÀ» ¾Æ·¡ °ªÀ¸·Î ´ëÄ¡ÇÑ ÈÄ¿¡ ¹®Á¦¸¦ Ç®°Í. int data[5] = { 1, 2, 3, 4, 5 }; =>> { } */ //¹®Á¦ 1. ´ÙÀ½ ÇÁ·Î±×·¥ÀÇ Ãâ·ÂÀ» ¾²½Ã¿À. using System; namespace Test1 { class List { int []s; List next; public List(int n, List l) { s = new int[n]; for (int i = 0; i < n; i++) s[i] = n; next = l; } public void link(List l) { next = l.next.next; } public override String ToString() { String x = ""; for (int i = 0; i < s.Length; i++) x = x + s[i]; if (next != null) x = x + next.ToString(); return x; } } class Program { static void Main(string[] args) { int[] data = { 1, 2, 3, 4, 5 }; List a = new List(data[0], null); List b = new List(data[1], a); List c = new List(data[2], b); List d = new List(data[3], c); List e = new List(data[4], d); e.link(b); Console.WriteLine(e); } } }