Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApp1
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.WriteLine("Please write number of operation:");
- int caseSwitch = Convert.ToInt32(Console.ReadLine());
- switch (caseSwitch)
- {
- case 1:
- //First task
- char a = Convert.ToChar(Console.ReadLine());
- if (IsUpper(a))
- {
- Console.WriteLine("Буква заглавная");
- }
- else
- {
- Console.WriteLine("Буква прописная");
- }
- Console.WriteLine("Done");
- Console.ReadKey();
- break;
- case 2:
- //Second task
- char b = Convert.ToChar(Console.ReadLine());
- if (isDigit(b))
- {
- Console.WriteLine("Это цифра");
- }
- else
- {
- Console.WriteLine("Это не цифра");
- }
- Console.WriteLine("Done");
- Console.ReadKey();
- break;
- case 3:
- int[] one = new[] { 1, 1, 2, 3, 4, 5, 5, 5, 5, 5, 6, 6, 6, 6 };
- 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 };
- Array finalArray = Ret_Array(one, two);
- for (int i = 0; i < finalArray.Length; i++)
- {
- Console.WriteLine(finalArray[i]);
- }
- Console.WriteLine("Done");
- break;
- }
- }
- //Проверка регистра буквы
- public static bool IsUpper(char c)
- {
- if (Convert.ToChar(c) <= 'Z')
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- //Проверка принадлежности к цифрам
- public static bool isDigit(char c)
- {
- if (c>='0' && c<='9')
- {
- return true;
- }
- else
- {
- return false;
- }
- }
- public static Array Ret_Array(int[] one, int[] two)
- {
- for (int i = 0; i < one.Length; i++)
- {
- Console.WriteLine(one[i]);
- }
- int[] finalArray = one;
- Console.ReadLine();
- return finalArray;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement