Beispiel #1
0
        static void Main(string[] args)
        {
            string[] input = Console.ReadLine().Split(", ");

            int n = int.Parse(Console.ReadLine());

            Article article = new Article();

            article.Title   = input[0];
            article.Content = input[1];
            article.Autor   = input[2];

            for (int i = 0; i < n; i++)
            {
                string[] command = Console.ReadLine().Split(": ");

                if (command[0] == "Edit")
                {
                    article.Edit(command[1]);
                }
                else if (command[0] == "ChangeAuthor")
                {
                    article.ChangeAutor(command[1]);
                }
                else if (command[0] == "Rename")
                {
                    article.Rename(command[1]);
                }
            }
            Console.WriteLine(article.ToString());
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            string[] tokens  = Console.ReadLine().Split(", ");
            Article  article = new Article(tokens[0], tokens[1], tokens[2]);

            int n = int.Parse(Console.ReadLine());

            for (int i = 0; i < n; i++)
            {
                string[] commArgs = Console.ReadLine().Split(": ");
                string   command  = commArgs[0];
                string   argument = commArgs[1];

                switch (command)
                {
                case "Edit":
                    article.Edit(argument);
                    break;

                case "ChangeAuthor":
                    article.ChangeAutor(argument);
                    break;

                case "Rename":
                    article.Rename(argument);
                    break;
                }
            }
            Console.WriteLine(article.ToString());
        }