Advertisement
peshopbs2

Untitled

Jan 22nd, 2020
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.97 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 CommandProcess
  8. {
  9. class Program
  10. {
  11. static List<int> nums;
  12.  
  13. static void Main(string[] args)
  14. {
  15. nums = Console.ReadLine()
  16. .Split(' ')
  17. .Select(int.Parse)
  18. .ToList();
  19.  
  20. string command = Console.ReadLine();
  21.  
  22. while(command!="End")
  23. {
  24. ProcessCommand(command);
  25. command = Console.ReadLine();
  26. }
  27. }
  28.  
  29. private static void ProcessCommand(string command)
  30. {
  31. string[] commandData = command.Split(' ').ToArray();
  32.  
  33. switch(commandData[0])
  34. {
  35. case "Print":
  36. PrintList();
  37. break;
  38. case "Add":
  39. AddToList();
  40. break;
  41. case "Remove":
  42. RemoveFromList();
  43. break;
  44. case "Reverse":
  45. //TODO: implement the method
  46. ReverseList();
  47. break;
  48. case "Average":
  49. //TODO: call and implement the method
  50. break;
  51. //TODO: Add case for SumOdd
  52. default:
  53. Console.WriteLine("The command {0} is not supported",
  54. commandData[0]);
  55. break;
  56. }
  57. }
  58.  
  59. //TODO: Add methods
  60.  
  61. private static void ReverseList()
  62. {
  63. //TODO: Implement the method using .Reverse()
  64.  
  65. }
  66.  
  67. private static void RemoveFromList()
  68. {
  69.  
  70. }
  71.  
  72. private static void AddToList()
  73. {
  74.  
  75. }
  76.  
  77. private static void PrintList()
  78. {
  79.  
  80. }
  81. }
  82. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement