static void Main(string[] args) { Console.WriteLine("ievadi uzdevuma nr."); string inp = Console.ReadLine(); Console.WriteLine("--------------------"); switch (inp) { case "1": int[] num = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2 }; Console.WriteLine(String.Join(",", num)); num = Task1.GetOnlySmallValues(num); Console.WriteLine(String.Join(",", num)); break; case "2": Console.Write("Ievadi paroli: "); string password = Console.ReadLine(); while (Task2.PasswordValidate(password) == false) { Console.WriteLine("Parole nav derīga, tai jābūt vismaz no 8 simboliem un tai jāsatur gan burti, gan skaitļi"); password = Console.ReadLine(); } break; default: Console.WriteLine("Nr. neatbilst uzdevumu skaitam."); break; } }
static void Main(string[] args) { Console.WriteLine("Ievadi uzdevuma nr.: "); string userInput = Console.ReadLine(); int x = Convert.ToInt32(userInput); switch (x) { case 1: int[] intArray = { 7, 2, 3, 4, 5, 6, 7 }; Task1.GetOnlySmallValues(intArray); Console.WriteLine(String.Join(",", intArray)); intArray = Task1.GetOnlySmallValues(intArray); Console.WriteLine(String.Join(",", intArray)); break; case 2: Console.WriteLine(Task2.ValidatePassword("1234")); Console.WriteLine(Task2.ValidatePassword("12345678")); Console.WriteLine(Task2.ValidatePassword("12A34789")); break; default: Console.WriteLine("Ievadi skatli robežās no 1 līdz 2!"); break; } }
static void Main(string[] args) { Console.OutputEncoding = Encoding.UTF8; bool check = false; while (!check) { Console.Write("Lūdzu. ievadiet veselo skaitļi 1 vai extra, lai izpildīt attiecīgo uzdevumu \n" + " (exit, lai izietu no programmas): "); switch (Console.ReadLine().Trim()) { case "1": { Random random = new Random(); int size = random.Next(6) + 5; int[] intArray = new int[size]; for (int i = 0; i < size; i++) { intArray[i] = random.Next(10) + 1; } Console.WriteLine("Sakumā int[] = " + String.Join(", ", intArray)); Console.WriteLine("Parveidots int[] = " + String.Join(", ", Task1.GetOnlySmallValues(intArray))); break; } case "extra": { Console.Write("Lūdzu ievadiet paroli: "); if (PasswordValidator.PasswordValidate(Console.ReadLine())) { Console.WriteLine("Parole ir derīga!"); } else { Console.WriteLine("Parole ir nederīga"); } break; } case "exit": { check = true; break; } default: { Console.WriteLine("Lūdzu evadiet pareizo ciparu vai vardu!!!"); break; } } } }
static void Main(string[] args) { int[] intArray = { 3, 5, 6, 6, 8, 2 }; Console.WriteLine(String.Join(",", intArray)); intArray = Task1.GetOnlySmallValues(intArray); Console.WriteLine(String.Join(",", intArray)); /*Console.WriteLine(String.Join(",", Task1.GetOnlySmallValues(intArray)));*/ Console.WriteLine(PasswordValidator.ValidatePassword("12345")); Console.WriteLine(PasswordValidator.ValidatePassword("12A34")); Console.WriteLine(PasswordValidator.ValidatePassword("12AGAFFS34")); }