Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Clight_09_consolMenu
- {
- class Program
- {
- static void Main(string[] args)
- {
- bool exitApp = true;
- bool exitColor = true;
- byte numMenu;
- byte numColor;
- string name = "Uknown";
- string age = "Uknown";
- string height = "Uknown";
- string passUser;
- string pass = " ";
- byte countPass = 3;
- Console.WriteLine("Привет, заполни анкету\n \n \n");
- while (exitApp == true)
- {
- Console.WriteLine("\nМеню:");
- Console.WriteLine("1 - Задать пароль");
- Console.WriteLine("2 - Ввести своё имя");
- Console.WriteLine("3 - Ввести свой возраст");
- Console.WriteLine("4 - Ввести свой рост");
- Console.WriteLine("5 - Посмотреть информацию о себе");
- Console.WriteLine("6 - Поменять цвет текста");
- Console.WriteLine("7 - Выход");
- numMenu = Convert.ToByte(Console.ReadLine());
- switch (numMenu)
- {
- case 1:
- Console.Write("Введите пароль: ");
- pass = Console.ReadLine();
- break;
- case 2:
- Console.Write("Введите своё имя: ");
- name = Console.ReadLine();
- break;
- case 3:
- Console.Write("Введите своё возраст: ");
- age = Console.ReadLine();
- break;
- case 4:
- Console.Write("Введите своё рост: ");
- height = Console.ReadLine();
- break;
- case 5:
- if (pass != " ")
- {
- for (byte i = 0; i < countPass; i++)
- {
- Console.WriteLine("Введите пароль.\nКоличество оставшихся попыток: " + (countPass - i) + "\n");
- passUser = Console.ReadLine();
- if (passUser == pass)
- {
- Console.WriteLine("\n\nИнформация о вас:");
- Console.WriteLine($"Имя: {name}\nВозраст: {age}\nРост: {height}\n");
- Console.WriteLine("Нажмите любую клавишу для возврата в меню\n\n");
- Console.ReadKey();
- break;
- }
- }
- }
- else
- {
- Console.WriteLine("Сначала задайте пароль в 1-ом пункте меню");
- }
- break;
- case 6:
- exitColor = true;
- while (exitColor == true)
- {
- Console.WriteLine("\nВыберете цвет текста:");
- Console.WriteLine("1 - Красный");
- Console.WriteLine("2 - Зеленый");
- Console.WriteLine("3 - Синий");
- Console.WriteLine("4 - Белый");
- Console.WriteLine("5 - Выход\n");
- numColor = Convert.ToByte(Console.ReadLine());
- switch (numColor)
- {
- case 1:
- Console.ForegroundColor = ConsoleColor.Red;
- break;
- case 2:
- Console.ForegroundColor = ConsoleColor.Green;
- break;
- case 3:
- Console.ForegroundColor = ConsoleColor.Blue;
- break;
- case 4:
- Console.ForegroundColor = ConsoleColor.White;
- break;
- case 5:
- exitColor = false;
- break;
- }
- }
- break;
- case 7:
- Console.WriteLine("\nЖдём вас снова!\n\n");
- exitApp = false;
- break;
- }
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment