Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Курсы_черновик
- {
- class Program
- {
- static void Main(string[] args)
- {
- Random rand = new Random();
- int userImput;
- string userImputPassword;
- string password = "";
- bool passwordOn = false;
- bool programmOn = true;
- while (programmOn)
- {
- while (passwordOn)
- {
- Console.WriteLine("Введите пароль:");
- userImputPassword = Console.ReadLine();
- if (userImputPassword == password)
- {
- Console.WriteLine("Верный пароль.\n");
- break;
- }
- else
- {
- Console.WriteLine("Неверный пароль!");
- }
- }
- Console.WriteLine("Выберите действие\nСоздать(убрать) пароль-1\nБросить игральный кубик-2\nИзменить цвет текста-3\nНарисовать прямоугольник-4\nЗакрыть программу-5");
- userImput = Convert.ToInt32(Console.ReadLine());
- switch (userImput)
- {
- case 1:
- if (!passwordOn)
- {
- Console.WriteLine("Придумайте пароль:");
- password = Console.ReadLine();
- passwordOn = true;
- }
- else
- {
- passwordOn = false;
- Console.WriteLine("Пароль убран");
- Console.ReadKey();
- }
- break;
- case 2:
- int number = rand.Next(1, 7);
- Console.WriteLine($"Выпавшее число - {number}");
- Console.ReadKey();
- break;
- case 3:
- Console.WriteLine("Какой цвет вы хотите выбрать?\nЖелтый-1\nКрасный-2\nБелый(стандартный)-3");
- userImput = Convert.ToInt32(Console.ReadLine());
- switch (userImput)
- {
- case 1:
- Console.ForegroundColor = ConsoleColor.Yellow;
- break;
- case 2:
- Console.ForegroundColor = ConsoleColor.Red;
- break;
- case 3:
- Console.ForegroundColor = ConsoleColor.Gray;
- break;
- }
- break;
- case 4:
- Console.Write("Введите высоту прямоугольника:");
- int squareHeight = Convert.ToInt32(Console.ReadLine());
- Console.Write("Введите ширину прямоугольника:");
- int squareWidth = Convert.ToInt32(Console.ReadLine());
- Console.Write("Из каких символов нарисовать пямоугольник:");
- char squareSymbol = Convert.ToChar(Console.ReadLine());
- Console.WriteLine();
- for (int i = 0; i < squareHeight; i++)
- {
- for (int l = 0; l < squareWidth; l++)
- {
- Console.Write(squareSymbol);
- }
- Console.WriteLine();
- }
- Console.ReadKey();
- break;
- case 5:
- programmOn = false;
- break;
- default:
- Console.WriteLine("Неправильный ввод!");
- Console.ReadKey();
- break;
- }
- Console.Clear();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement