Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace Сprogect
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.WriteLine("Введите номер команды");
- Console.WriteLine("1-сменить цвет консоли");
- Console.WriteLine("2-сменить цвет фона текста");
- Console.WriteLine("3-очистить консоль");
- Console.WriteLine("4-установить имя");
- Console.WriteLine("5-Установить пароль");
- Console.WriteLine("6-вывести имя (после ввода пароля)");
- Console.WriteLine("7-выход из программы");
- int userChoice;
- string name="Roman";
- string password="1234";
- string userPassword;
- bool ESC = false;
- while (ESC!=true) {
- userChoice = Convert.ToInt32(Console.ReadLine());
- switch (userChoice)
- {
- case 1:
- Console.ForegroundColor = ConsoleColor.Red;
- break;
- case 2:
- Console.BackgroundColor = ConsoleColor.Green;
- break;
- case 3:
- Console.Clear();
- break;
- case 4:
- Console.WriteLine("Введите новое имя");
- name = Console.ReadLine();
- break;
- case 5:
- Console.WriteLine("Введите новый пароль");
- password = Console.ReadLine();
- break;
- case 6:
- Console.WriteLine("Введите пароль");
- userPassword = Console.ReadLine();
- if (userPassword == password) {
- Console.WriteLine(name);
- }
- else
- {
- Console.WriteLine("Вы ввели неверный пароль");
- }
- break;
- case 7:
- ESC = true;
- break;
- default:
- Console.WriteLine("Выберите команду из списка");
- break;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement