Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ConsoleApp13
- {
- internal class Program
- {
- static void Main(string[] args)
- {
- const int CommandSetName = 1;
- const int CommandSetPassword = 2;
- const int CommandChangePassword = 3;
- const int CommandExit = 4;
- int userCommandInput;
- string userName;
- string userPassword = "";
- string userOldPassword;
- bool isWork = true;
- while (isWork)
- {
- Console.WriteLine($"Введите команду : \n {CommandSetName}) Установить имя\n {CommandSetPassword}) Установить пароль" +
- $"\n {CommandChangePassword}) Изменить пароль\n {CommandExit}) Выход");
- userCommandInput = Convert.ToInt32(Console.ReadLine());
- switch (userCommandInput)
- {
- case CommandSetName:
- Console.WriteLine("Установите имя");
- userName = Console.ReadLine();
- break;
- case CommandSetPassword:
- Console.WriteLine("Установите пароль");
- userPassword = Console.ReadLine();
- break;
- case CommandChangePassword:
- Console.WriteLine("Для замены пароля введите старый пароль : ");
- userOldPassword = Console.ReadLine();
- if (userOldPassword == userPassword)
- {
- Console.WriteLine("Введите новый пароль : ");
- userPassword = Console.ReadLine();
- }
- else
- {
- Console.WriteLine("Пароль не подходит.");
- }
- break;
- case CommandExit:
- isWork = false;
- break;
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment