Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.19 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. namespace _4._Songs
  5. {
  6. class Song
  7. {
  8. public string TypeList { get; set; }
  9. public string Name { get; set; }
  10. public string Time { get; set; }
  11. }
  12. class Program
  13. {
  14. static void Main()
  15. {
  16. int numSongs = int.Parse(Console.ReadLine());
  17. List<Song> songs = new List<Song>();
  18.  
  19. for (int i=0; i< numSongs; i++)
  20. {
  21. string[] data = Console.ReadLine().Split("_");
  22. Song song = new Song();
  23. song.TypeList = data[0];
  24. song.Name = data[1];
  25. song.Time = data[2];
  26. songs.Add(song);
  27. }
  28. string type = Console.ReadLine();
  29. if (type == "all")
  30. {
  31. foreach (var item in songs)
  32. {
  33. Console.WriteLine(item.Name);
  34. }
  35. }
  36. else
  37. {
  38. foreach (var item in songs)
  39. {
  40. if (item.TypeList == type) Console.WriteLine(item.Name);
  41. }
  42. }
  43. }
  44. }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement