Advertisement
Reshkin

Untitled

Oct 24th, 2020
566
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.83 KB | None | 0 0
  1. using System;
  2.  
  3.  
  4.  
  5. namespace ConsoleApp1
  6. {
  7.     class Program
  8.     {
  9.         static void Main(string[] args)
  10.         {
  11.             Console.WriteLine("Please write number of operation:");
  12.             int caseSwitch = Convert.ToInt32(Console.ReadLine());
  13.             switch (caseSwitch)
  14.             {
  15.                 case 1:
  16.                     //First task
  17.                     char a = Convert.ToChar(Console.ReadLine());
  18.                     if (IsUpper(a))
  19.                     {
  20.                         Console.WriteLine("Буква заглавная");
  21.                     }
  22.                     else
  23.                     {
  24.                         Console.WriteLine("Буква прописная");
  25.                     }
  26.                     Console.WriteLine("Done");
  27.                     Console.ReadKey();
  28.                     break;
  29.                 case 2:
  30.                     //Second task
  31.                     char b = Convert.ToChar(Console.ReadLine());
  32.                     if (isDigit(b))
  33.                     {
  34.                         Console.WriteLine("Это цифра");
  35.                     }
  36.                     else
  37.                     {
  38.                         Console.WriteLine("Это не цифра");
  39.                     }
  40.                     Console.WriteLine("Done");
  41.                     Console.ReadKey();
  42.                     break;
  43.                 case 3:
  44.                     int[] one = new[] { 1, 1, 2, 3, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6 };
  45.                     int[] two = new[] { 1, 1, 1, 1, 1, 1, 1, 7, 7, 7, 7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9 };
  46.                     Array finalArray = Ret_Array(one, two);
  47.                     for (int i = 0; i < finalArray.Length; i++)
  48.                     {
  49.                         Console.WriteLine(finalArray[i]);
  50.                     }
  51.                     Console.WriteLine("Done");
  52.                     break;
  53.             }
  54.         }
  55.         //Проверка регистра буквы
  56.         public static bool IsUpper(char c)
  57.         {
  58.             if (Convert.ToChar(c) <= 'Z')
  59.             {
  60.                 return true;
  61.             }
  62.             else
  63.             {
  64.                 return false;
  65.             }
  66.  
  67.         }
  68.         //Проверка принадлежности к цифрам
  69.         public static bool isDigit(char c)
  70.         {
  71.             if (c>='0' && c<='9')
  72.             {
  73.                 return true;
  74.             }
  75.             else
  76.             {
  77.                 return false;
  78.             }
  79.         }
  80.         public static Array Ret_Array(int[] one, int[] two)
  81.         {
  82.             for (int i = 0; i < one.Length; i++)
  83.             {
  84.                 Console.WriteLine(one[i]);
  85.             }
  86.             int[] finalArray = one;
  87.             Console.ReadLine();
  88.             return finalArray;
  89.         }
  90.     }
  91. }
  92.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement