Exemple #1
0
        static void Main(string[] args)
        {
            {
                int count = 0;

                string line = "Outlook,Temperature,Humidity,Windy,Play*Sunny,hot,high,false,no*Sunny,hot,high,true,no*Overcast,hot,high,false,yes*Rainy,mild,high,false,yes*Rainy,cool,normal,false,yes*Rainy,cool,normal,true,no*Overcast,cool,normal,true,yes*Sunny,mild,high,false,no";

                string[] arr = line.Split('*');

                foreach (char a in arr[0])
                    if (a == ',') count++;

                string[][] mass = new string[arr.Length][];
                for (int i = 0; i < arr.Length; i++)
                    mass[i] = arr[i].Split(',');

                Tree tree = new Tree();

                act(mass, tree, count);

                //выводим дерево на консоль
                tree.Show();
            }
            Console.ReadKey();
        }