Advertisement
GabrielDas

Untitled

Mar 3rd, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5. namespace P03Articles_2._0
  6. {
  7. class Program
  8. {
  9. static void Main(string[] args)
  10. {
  11. int numberOfCommands = int.Parse(Console.ReadLine());
  12. List<string> articles = new List<string>();
  13.  
  14. for (int i=0;i<numberOfCommands;i++)
  15. {
  16. string[] newArticles = Console.ReadLine().Split(", ").ToArray();
  17. Article article = new Article();
  18. article.Title = newArticles[0];
  19. article.Content = newArticles[1];
  20. article.Author = newArticles[2];
  21.  
  22. string output = article.Title + " - " + article.Content + ": " + article.Author;
  23. articles.Add(output);
  24.  
  25. }
  26.  
  27. string command = Console.ReadLine();
  28.  
  29. if (command == "title")
  30. {
  31. articles.OrderBy(articles[0]);
  32. }
  33. }
  34. }
  35.  
  36. class Article
  37. {
  38. public string Title { get; set; }
  39. public string Content { get; set; }
  40. public string Author { get; set; }
  41.  
  42. public override string ToString()
  43. {
  44. return $"{Title} - {Content}: {Author}";
  45. }
  46.  
  47.  
  48. }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement