Advertisement
Guest User

Untitled

a guest
Mar 24th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.05 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace _2
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. string input;
  14. List<string> names = Console.ReadLine().Split(',').ToList();
  15. do
  16. {
  17. input = Console.ReadLine();
  18. switch (input)
  19. {
  20. case "Add visitor":
  21. string visitor = Console.ReadLine();
  22. names.Add(visitor);
  23. break;
  24. case "Add visitor on position":
  25. string visitor1 = Console.ReadLine();
  26. byte pos = byte.Parse(Console.ReadLine());
  27. names.Insert(pos, visitor1);
  28. break;
  29. case "Remove visitor on position":
  30. byte pos1 = byte.Parse(Console.ReadLine());
  31. names.RemoveAt(pos1);
  32. break;
  33. case "Remove last visitor":
  34. names.RemoveAt(names.Count-1);
  35. break;
  36. case "Remove first visitor":
  37. names.RemoveAt(0);
  38. break;
  39.  
  40. }
  41. } while (input != "END");
  42.  
  43.  
  44.  
  45. Console.WriteLine(string.Join(", ", names));
  46.  
  47.  
  48. }
  49.  
  50. }
  51. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement