static void Main(string[] args) { Console.Write("Ключевое слово: "); string keyWord = Console.ReadLine().ToLower(); Console.Write("Ключ: "); int key = Convert.ToInt32(Console.ReadLine()); Caesar.createNewAlpha(keyWord, key); Console.WriteLine(); Console.WriteLine("Шифрованный алфавит: " + Caesar.getNewAlpha()); Console.WriteLine(); string open = "Hello!My name is Kate. My surname is Pavlova. I’m seven. I live in Minsk, in Pushkin street. I go to school number 214. I’m in the first form.I’ve got a family. It is small. We are a family of four. I’ve got a father, a mother and a brother. I haven’t got a sister. My father is.an engineer. He works in a plant. My mother is a teacher. She works at school. My brother is little. He doesn’t go to school. He goes to a kindergarten. He is four.I like to play. I have got many toys. I have got a teddy-bear, dolls, a ball, a toy monkey and a doll’s house. I like the doll’s house very much. It is big. It is pink and nice.We have got a cat. It is small and grey. It is very nice. It has big blue eyes, a funny nose, a small mouth and sharp teeth. Its ears are small. It can play hide-and-seek. I love my cat. It loves me, too.I go to school. I’m a pupil. I have got many friends. We have our classroom. It is nice and large. You can see twelve desks, many chairs, our teacher’s table, a blackboard, two bookcases in the classroom. At the lessons we have pens, pencils, pencil-boxes or pencil-cases, rulers, erasers, textbooks, exercise-books, record-books on the desks.I like to read. I can read well. I like fairytales. They are very interesting. I like «Cinderella» and «Pinocchio» best.Hello!My name is Kate. My surname is Pavlova. I’m seven. I live in Minsk, in Pushkin street. I go to school number 214. I’m in the first form.I’ve got a family. It is small. We are a family of four. I’ve got a father, a mother and a brother. I haven’t got a sister. My father is.an engineer. He works in a plant. My mother is a teacher. She works at school. My brother is little. He doesn’t go to school. He goes to a kindergarten. He is four.I like to play. I have got many toys. I have got a teddy-bear, dolls, a ball, a toy monkey and a doll’s house. I like the doll’s house very much. It is big. It is pink and nice.We have got a cat. It is small and grey. It is very nice. It has big blue eyes, a funny nose, a small mouth and sharp teeth. Its ears are small. It can play hide-and-seek. I love my cat. It loves me, too.I go to school. I’m a pupil. I have got many friends. We have our classroom. It is nice and large. You can see twelve desks, many chairs, our teacher’s table, a blackboard, two bookcases in the classroom. At the lessons we have pens, pencils, pencil-boxes or pencil-cases, rulers, erasers, textbooks, exercise-books, record-books on the desks.I like to read. I can read well. I like fairytales. They are very interesting. I like «Cinderella» and «Pinocchio» best.Hello!My name is Kate. My surname is Pavlova. I’m seven.", close = ""; Console.Write("Открытое сообщение: "); //open = Console.ReadLine().ToLower(); close = Caesar.encrypt(open); Console.WriteLine(); Console.WriteLine("Шифрованное сообщение: " + close); open = Caesar.decrypt(close); Console.WriteLine(); Console.WriteLine("Расшифрованное сообщение: " + open); Console.WriteLine("-----------------------------------------------------------------------------------"); string close1 = Trisemus.Encrypt(); Console.WriteLine(close1); }
static void Main(string[] args) { Console.WriteLine("Алгоритмы: Атбаш и Caesar\n" + "Вариант 3.\nВыполнил студент 465 группы\nНикита Васильевич Зотов\n"); bool inputSuccess = true; Random rnd = new Random(); End ex = new End(); while (inputSuccess) { Console.WriteLine("\nДля ввода данных с клавиатуры нажмите 1\nДля ввода данных из файла нажмите 2\nДля рандомного заполнения нажмите 3\nДля выхода нажмите 4"); List <char> primary = new List <char>(); int size = 0; int value = 0; Menu menu = new Menu(); var choise = (Cases)menu.ChoiseCase(); switch (choise) { case Cases.CONSOLE: InputConsole fillList = new InputConsole(); primary = fillList.ReadList(); //Заполнили список элементов break; case Cases.FILE: Console.WriteLine("\nУкажите путь к данным в формате (D:\\AZINO777\\...\nВведите числа в строчку, десятичные дроби введите в формате 1.1 Ввод закончите символом Enter"); InputFile file = new InputFile(); primary = file.WorkWithFile(); break; case Cases.RAND: size = rnd.Next(1, 20); InputRand fill = new InputRand(); primary = fill.RandomFill(size); break; case Cases.EXIT: System.Environment.Exit(0); break; } string answerAtbash = ""; string answerCaesar = ""; value = 0; if (primary.Count > 0) { var inceptive = String.Join("", primary.ToArray()); IChiper atbash = new Atbash(); IChiper caesar = new Caesar(); var code = (Code)ex.EnumAns(); switch (code) { case Code.ENCODE_ATB: value = 1; answerAtbash = atbash.Encode(inceptive); Console.WriteLine("Результат шифрования методом Атбаш: " + answerAtbash); break; case Code.DECODE_ATB: value = 2; answerAtbash = atbash.Decode(inceptive); Console.WriteLine("Результат шифрования методом Атбаш: " + answerAtbash); break; case Code.ENCODE_CEA: value = 3; answerCaesar = caesar.Encode(inceptive); Console.WriteLine("Результат шифрования методом Caesar: " + answerCaesar); break; case Code.DECODE_CEA: value = 4; answerCaesar = caesar.Decode(inceptive); Console.WriteLine("Результат шифрования методом Caesar: " + answerCaesar); break; } bool saveChoise = false; Console.WriteLine("Желаете сохранить результаты работы программы?"); saveChoise = ex.Ans(); bool deleteInfo = false; if (saveChoise) { Console.WriteLine("Введите путь"); string path = Console.ReadLine(); if (File.Exists(path)) { Console.WriteLine("Файл существует. При сохранении данные будут стёрты. Желаете перезаписать файл?"); deleteInfo = ex.Ans(); if (deleteInfo) { ex.Saving(primary, answerAtbash, answerCaesar, path, value); } else { continue; } } else { ex.Saving(primary, answerAtbash, answerCaesar, path, value); } } Console.WriteLine("Желаете сохранить исходные данные программы?"); saveChoise = ex.Ans(); deleteInfo = false; if (saveChoise) { Console.WriteLine("Введите путь"); string path = Console.ReadLine(); if (File.Exists(path)) { Console.WriteLine("Файл существует. При сохранении данные будут стёрты. Желаете перезаписать файл?"); deleteInfo = ex.Ans(); if (deleteInfo) { ex.Saving(primary, answerAtbash, answerCaesar, path, 0); } else { continue; } } else { ex.Saving(primary, answerAtbash, answerCaesar, path, 0); } } } Console.WriteLine("Желаете протестировать программу еще раз?"); inputSuccess = ex.Ans(); continue; } }