public static string CreateString() //Создание строки { int k; string beginString = null; Random rnd = new Random(); k = Easy.Choice(2, 1, "Ошибка. Выберите пункт из меню:", "Как вы хотите создать строку?" + "\n 1 - Ввести с клавиатуры\n 2 - С помощью случайного заполнения"); if (k == 1) { Console.WriteLine("\n Введите строку:"); beginString = Console.ReadLine(); } else { string chars = "a bcde fgh ijklmn_opqr stuvwx yz12 34567890, ;:ABCD EFG HIJKLM NOPQRSRUV WX YZ.!? " + "абв гдеёж з ийклм_нопрст уф хцчшщъыь эюя АБВГДЕ _ЁЖЗИЙК ЛМНО_ПРС ТУФХЦЧШЩЪЫ ЬЭ ЮЯ"; int length = rnd.Next(10, 50); char[] symbols = new char[length]; for (int i = 0; i < length; i++) { symbols[i] = chars[rnd.Next(0, chars.Length - 1)]; } string randomstring = new string (symbols); beginString = randomstring; } Console.WriteLine(); OutputString(beginString); return(beginString); }
public static int FlexMenu(string task, int max, int min) { Console.ForegroundColor = ConsoleColor.White; Console.WriteLine(task); int choice = Easy.Choice(max, min, "Ошибка. Выберите пункт из меню:"); Console.WriteLine(); return(choice); }
public static int MenuForRagArrays() { Console.ForegroundColor = ConsoleColor.White; int secondChoice; Console.WriteLine("1 - Пересоздать массив"); Console.WriteLine("2 - Напечатать массив"); Console.WriteLine("3 - Удалить все строки, содержащие нули"); Console.WriteLine("4 - Назад"); do { secondChoice = Easy.EnterInt(); if ((secondChoice < 1) || (secondChoice > 4)) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("\nТакого номера команды нет, повторите ввод"); Console.ForegroundColor = ConsoleColor.White; } } while ((secondChoice < 1) || (secondChoice > 4)); Console.WriteLine(); return(secondChoice); }
public static int MainMenu() { int firstChoice; Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("1 - Работа с одномерными массивами"); Console.WriteLine("2 - Работа с двумерными массивами"); Console.WriteLine("3 - Работа с рваными массивами"); Console.WriteLine("4 - Выход"); Console.WriteLine("\n Введите номер команды:"); do { firstChoice = Easy.EnterInt(); if ((firstChoice < 1) || (firstChoice > 4)) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("\nТакого номера команды нет, повторите ввод"); Console.ForegroundColor = ConsoleColor.White; } } while ((firstChoice < 1) || (firstChoice > 4)); Console.WriteLine(); return(firstChoice); }