static void Main(string[] args) { string q = Console.ReadLine(); List <string> parameters = q.Split(", ").ToList(); int count = int.Parse(Console.ReadLine()); Articles article = new Articles(parameters[0], parameters[1], parameters[2]); for (int i = 0; i < count; i++) { List <string> currCommand = Console.ReadLine().Split(": ").ToList(); if (currCommand[0] == "Edit") { article.Edit(currCommand[1]); } if (currCommand[0] == "ChangeAuthor") { article.ChangeAuthor(currCommand[1]); } if (currCommand[0] == "Rename") { article.Rename(currCommand[1]); } } Console.WriteLine(article.ToString()); }
static void Main() { string[] input = Console.ReadLine().Split(','); Articles newArticle = new Articles(input[0].TrimStart(), input[1].TrimStart(), input[2].TrimStart()); int n = int.Parse(Console.ReadLine()); while (n > 0) { input = Console.ReadLine().Split(':'); switch (input[0]) { case "Edit": newArticle.Edit(input[1].TrimStart()); break; case "ChangeAuthor": newArticle.ChangeAuthor(input[1].TrimStart()); break; case "Rename": newArticle.Rename(input[1].TrimStart()); break; } n--; } Console.WriteLine(newArticle); }
static void Main(string[] args) { string[] pepar = Console.ReadLine().Split(new string[] { ", " }, StringSplitOptions.RemoveEmptyEntries); string title = pepar[0]; string content = pepar[1]; string autor = pepar[2]; Articles articles = new Articles(title, content, autor); int n = int.Parse(Console.ReadLine()); int counter = 0; while (n > counter) { string[] splitedinput = Console.ReadLine().Split(new string[] { ": " }, StringSplitOptions.RemoveEmptyEntries).ToArray(); string command = splitedinput[0]; if (command == "Edit") { string NewContent = splitedinput[1]; articles.Edit(NewContent); } else if (command == "ChangeAuthor") { string NewAutor = splitedinput[1]; articles.ChangeAutor(NewAutor); } else if (command == "Rename") { string NewTitle = splitedinput[1]; articles.Rename(NewTitle); } counter++; } Console.WriteLine(articles); }