Advertisement
Infiniti_Inter

Практикум 3, задание 3, номер 1

Sep 9th, 2019
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.67 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 mainSolution
  8. {
  9.     public class MyException : Exception
  10.     {
  11.         public MyException(string messege) : base(message: messege + "\n\n\n Exception founded by Decibit\n\n\n") { }
  12.         public MyException() : base()
  13.         {
  14.  
  15.         }
  16.         public void Messsage()
  17.         {
  18.             Console.WriteLine("\n\n\n\n\n\n Invalid number, please enter a number from 1 to 12 \n\n\n\n\n\n");
  19.         }
  20.  
  21.  
  22.     }
  23.     class Input
  24.     {
  25.         private static IEnumerator<string> getin()
  26.         {
  27.             while (true)
  28.                 foreach (string s in Console.ReadLine().Split().Where(x => x.Length > 0))
  29.                     yield return s;
  30.         }
  31.  
  32.         private IEnumerator<string> inp = getin();
  33.  
  34.         public string GetString() { inp.MoveNext(); return inp.Current; }
  35.         public int GetInt() { return int.Parse(GetString()); }
  36.         public long GetLong() { return long.Parse(GetString()); }
  37.         public double GetDouble() { return double.Parse(GetString()); }
  38.     }
  39.  
  40.     static class Program
  41.     {
  42.         static public Input cin = new Input();
  43.  
  44.  
  45.  
  46.         static void Main(string[] args)
  47.         {
  48.             string[] named = new string[12] { "January", "February", "March", "April",
  49.                 "May", "June", "July", "August", "September", "October", "November", "December"};
  50.             int m = cin.GetInt();
  51.             m--;
  52.             for (int i = 0; i < 12; i++)
  53.             {
  54.                 if (i == m)
  55.                     Console.WriteLine(named[i]);
  56.             }
  57.  
  58.         }
  59.     }
  60.  
  61. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement