Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace CommandProcess
- {
- class Program
- {
- static List<int> nums;
- static void Main(string[] args)
- {
- nums = Console.ReadLine()
- .Split(' ')
- .Select(int.Parse)
- .ToList();
- string command = Console.ReadLine();
- while(command!="End")
- {
- ProcessCommand(command);
- command = Console.ReadLine();
- }
- }
- private static void ProcessCommand(string command)
- {
- string[] commandData = command.Split(' ').ToArray();
- switch(commandData[0])
- {
- case "Print":
- PrintList();
- break;
- case "Add":
- AddToList();
- break;
- case "Remove":
- RemoveFromList();
- break;
- case "Reverse":
- //TODO: implement the method
- ReverseList();
- break;
- case "Average":
- //TODO: call and implement the method
- break;
- //TODO: Add case for SumOdd
- default:
- Console.WriteLine("The command {0} is not supported",
- commandData[0]);
- break;
- }
- }
- //TODO: Add methods
- private static void ReverseList()
- {
- //TODO: Implement the method using .Reverse()
- }
- private static void RemoveFromList()
- {
- }
- private static void AddToList()
- {
- }
- private static void PrintList()
- {
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement