Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace P03Articles_2._0
- {
- class Program
- {
- static void Main(string[] args)
- {
- int numberOfCommands = int.Parse(Console.ReadLine());
- List<string> articles = new List<string>();
- for (int i=0;i<numberOfCommands;i++)
- {
- string[] newArticles = Console.ReadLine().Split(", ").ToArray();
- Article article = new Article();
- article.Title = newArticles[0];
- article.Content = newArticles[1];
- article.Author = newArticles[2];
- string output = article.Title + " - " + article.Content + ": " + article.Author;
- articles.Add(output);
- }
- string command = Console.ReadLine();
- if (command == "title")
- {
- articles.OrderBy(articles[0]);
- }
- }
- }
- class Article
- {
- public string Title { get; set; }
- public string Content { get; set; }
- public string Author { get; set; }
- public override string ToString()
- {
- return $"{Title} - {Content}: {Author}";
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement