C#/문제해결

0620 오

버스창문 2022. 6. 20. 18:03
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;

namespace study08
{
    public class test
    {
        public test()
        {
            string test = File.ReadAllText("./test.txt");
            Console.WriteLine(test);
            string[] tests = test.Split('\n');

            /*foreach(string a in tests)
            {
                Console.WriteLine(a);
                Console.WriteLine();
            }*/
            string[] name = tests[0].Split('	');
            string[] type = tests[1].Split('	');
            List<List<string>> inside = new List<List<string>>();

            for (int i = 2; i < tests.Length; i++)
            {
                string[] temp = tests[i].Split('	');

                var list = new List<string>();
                foreach(string a in temp)
                {
                    list.Add(a);
                }

                inside.Add(list); 
            }
            foreach(string a in name)
            {
                Console.WriteLine(a);
            }
            foreach (string a in type)
            {
                Console.WriteLine(a);
            }
            Console.WriteLine();
            foreach(List<string> a in inside)
            {
                foreach(string b in a)
                {
                    Console.WriteLine(b);
                }
                Console.WriteLine();
            }
        }
    }
}

인터레스팅하다

'C# > 문제해결' 카테고리의 다른 글

0719 Canvas가 여러개일때  (0) 2022.07.19
0712 총알 발사 방향 바꾸기  (0) 2022.07.12
0701 시간  (0) 2022.07.01
0616 액션안에 액션  (0) 2022.06.16
백준 4344번  (0) 2022.06.15