static void Main(string[] args) { (double a1, double b1) = ReadTask1(); Console.WriteLine($"Test task #1 : {Task1.Count(a1, b1)}"); (double x, double y) = ReadTask2(); Console.WriteLine($"Test task #2 : {Task2.IdentifyQuarterOfPoint(x, y)}"); (double a3, double b3, double c3) = ReadTask3(); double[] result3 = Task3.SortToBigger(a3, b3, c3); PrintArray(result3, 3); (double a4, double b4, double c4) = ReadTask4(); double[] result4 = Task4.SolveSquareEquation(a4, b4, c4); PrintArray(result4, 4); int num = ReadTask5(); Console.WriteLine($"Test task #5 : {Task5.ConvertToLetter(num)}"); }
static void Main(string[] args) { int n = 100; int[] array = new int[n]; Random random = new Random(); for (int i = 0; i < array.Length; i++) { array[i] = random.Next(-100, 101); } for (int i = 0; i < array.Length; i++) { Console.Write(array[i] + " "); } Console.WriteLine(); Console.WriteLine($"test task #1 : {Task1.FindMin(array)}"); Console.WriteLine($"test task #2 : {Task2.FindMax(array)}"); Console.WriteLine($"test task #3 : {Task3.FindIndexOfMin(array)}"); Console.WriteLine($"test task #4 : {Task4.FindIndexOfMax(array)}"); Console.WriteLine($"test task #5 : {Task5.SumOfElementsWithOddIndexes(array)}"); Console.Write("test task #5: "); PrintArray(Task6.Reverse(array)); Console.WriteLine($"test task #7 : {Task7.CountOfOddElements(array)}"); Console.Write("test task #8 : "); PrintArray(Task8.SwapHalves(array)); Console.Write("test task #9 Select: "); PrintArray(Task9Select.SortBySelect(array)); Console.Write("test task #9 Insert: "); PrintArray(Task9Insert.SortByInsert(array)); Console.Write("test task #10 Buble: "); PrintArray(Task10Bubble.SortByBubble(array)); }
static void Main(string[] args) { Console.WriteLine("Test tasks for Profsoft:"); int select; do { Console.Clear(); Console.WriteLine("Select the number of a task:"); Console.WriteLine("1. Task #1."); Console.WriteLine("2. Task #2."); Console.WriteLine("3. Task #3."); Console.WriteLine("4. Task #4."); Console.WriteLine("5. Task #5."); Console.WriteLine("0. Exit."); if (int.TryParse(Console.ReadLine(), out select)) { switch (select) { case 1: Console.Clear(); Console.WriteLine("Task #1:"); string str = null; foreach (var i in Task1.SortArray(Checkers.ArrayChecker())) { str += i + " "; } Console.WriteLine($"Sorting completed!\nSorted array: {str}"); Console.ReadKey(); break; case 2: Console.Clear(); Console.WriteLine("Task #2:"); var res = Task2.SearchInArray(Checkers.CheckNumber()); if (res != null) { Console.WriteLine($"\nThe number is in the array: {res}"); } Console.ReadKey(); break; case 3: Console.Clear(); Console.WriteLine("Task #3:"); var coordinates = Checkers.CoordinatesChecker(); Console.WriteLine($"Gets into:{Task3.CheckCoordinates(coordinates[0], coordinates[1])}"); Console.ReadKey(); break; case 4: Console.Clear(); Console.WriteLine("Task #4:"); Console.WriteLine($"Sum: {Task4.SumOfNumbers()}"); Console.ReadKey(); break; case 5: Console.Clear(); Console.WriteLine("Task #5:"); Console.WriteLine("Warning: All elements, except one, occur exactly two times."); Console.WriteLine($"Unique element: {Task5.FindUnique(Checkers.ArrayChecker())}"); Console.ReadKey(); break; case 0: break; default: Console.WriteLine("Wrong number!"); Console.ReadKey(); break; } } else { select = -1; Console.WriteLine("Invalid input!"); Console.ReadKey(); } }while (select != 0); }