Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace lesson2
- {
- class Program
- {
- static void Main(string[] args)
- {
- string name = "";
- string password = "123";
- bool isAuthorized = false;
- int tryCount = 3;
- float money = 300;
- string help = "GetName - Отобразить имя\nSetName - Установить имя\nВadge - Нарисовать бэйджик\nChangePassword - смена пароля\nTheme - цветовая тема меню\nСтандартный пароль 123";
- string userInput = "";
- while(userInput != "exit") {
- Console.WriteLine("Добро пожаловать, в Личный кабинет\nВведите команду");
- userInput = Console.ReadLine();
- switch (userInput.ToLower())
- {
- case "getname":
- Console.Clear();
- if (name == "")
- {
- Console.WriteLine("Ваше имя на не известно, представтесь с помощью SetName");
- }
- else { Console.WriteLine("Ваше имя: " + name); }
- break;
- case "setname":
- Console.Clear();
- if (!isAuthorized)
- {
- while (tryCount-- != 0)
- {
- Console.WriteLine("Для смены имени введите пароль: ");
- userInput = Console.ReadLine();
- if(password == userInput)
- {
- isAuthorized = true;
- Console.WriteLine("Введите ваше имя: ");
- name = Console.ReadLine();
- Console.WriteLine("Имя успешно изменено на " + name);
- break;
- }
- else
- {
- Console.WriteLine("Неверный пароль, осталось" + tryCount + " попыток.");
- }
- }
- }
- else {
- Console.WriteLine("Введите ваше имя: ");
- name = Console.ReadLine();
- Console.WriteLine("Имя успешно изменено на " + name);
- }
- break;
- case "badge":
- Console.Clear();
- Console.WriteLine("Сейчас нарисуем вам бэйджик, какой символ хотите для рамки?");
- userInput = Console.ReadLine();
- if(name == "")
- {
- Console.WriteLine("Вы забыли представиться, используйте SetName");
- }
- else
- {
- Console.Write(userInput + userInput + userInput);
- for(int i = 0; i <= name.Length; i++)
- {
- Console.Write(userInput);
- }
- Console.WriteLine(userInput + userInput );
- Console.WriteLine(userInput + " " + name + " " + userInput);
- Console.Write(userInput + userInput + userInput);
- for (int i = 0; i <= name.Length; i++)
- {
- Console.Write(userInput);
- }
- Console.Write(userInput + userInput);
- Console.WriteLine();
- }
- break;
- case "changepassword":
- Console.Clear();
- Console.WriteLine("Для сменны пароля введите старый пароль:");
- userInput = Console.ReadLine();
- while(tryCount-- != 0) {
- if (password == userInput)
- {
- Console.WriteLine("Введите новый пароль:");
- password = Console.ReadLine();
- Console.WriteLine("Новый пароль установлен успешно!");
- isAuthorized = false;
- break;
- }
- else
- {
- Console.WriteLine("Неверный пароль, у вас осталось " + tryCount + " попыток");
- }
- }
- break;
- case "theme":
- Console.WriteLine("Настройка темы меню\nMatrix\nPony\nHard\nExit - что бы выйти");
- userInput = Console.ReadLine();
- switch (userInput.ToLower())
- {
- case "matrix":
- Console.ForegroundColor = ConsoleColor.Green;
- Console.BackgroundColor = ConsoleColor.Black;
- Console.Clear();
- break;
- case "pony":
- Console.ForegroundColor = ConsoleColor.Magenta;
- Console.BackgroundColor = ConsoleColor.Cyan;
- Console.Clear();
- break;
- case "hard":
- Console.ForegroundColor = ConsoleColor.DarkBlue;
- Console.BackgroundColor = ConsoleColor.Black;
- Console.Clear();
- break;
- case "Exit":
- break;
- default:
- Console.Clear();
- Console.WriteLine("Нет такой темы! Ставим дефолтную :)");
- Console.ResetColor();
- break;
- }
- break;
- case "?":
- case "help":
- Console.Clear();
- Console.WriteLine(help);
- break;
- case "exit":
- Console.WriteLine("BB!");
- break;
- default:
- Console.Clear();
- Console.WriteLine("Команда не распознана, для списка команд наберите Help или ?");
- break;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement