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 ConsoleApp5
- {
- class Program
- {
- static void Main(string[] args)
- {
- bool runProgramm = true;//Исправил
- bool colorConsole = false;
- Console.WriteLine("Добро пожаловать в консоль. Напишите команду help, чтобы узнать другие команды");
- while (runProgramm)
- {
- Console.Write("Введите команду: ");
- string userCommand = Console.ReadLine();
- switch (userCommand)
- {
- case "help":
- Console.WriteLine("1.help\n" +
- "2.exit\n" +
- "3.changeConsoleColor - поменять цвет консоли на зеленый и обратно на белый\n" +
- "4.apt moo\n" +
- "5.piramid");
- break;
- case "changeConsoleColor":
- if (colorConsole == false)
- {
- Console.ForegroundColor = ConsoleColor.Green;
- colorConsole = true;
- }
- else
- {
- Console.ResetColor();
- colorConsole = false;
- }
- break;
- case "exit":
- runProgramm = false;
- break;
- case "apt moo":
- Console.WriteLine("" +
- "\n (__)" +
- "\n (00)" +
- "\n /------\\/" +
- "\n */ | ||\n" +
- " /\\---/\\ " +
- "\n ~~ ~~ \n" +
- "....'Have you mooed today?'...");
- break;
- case "piramid":
- //Убрал if из-за не надобности
- int size = Convert.ToInt32(Console.ReadLine());
- for (int i = 1; i <= size; i += 2)
- {
- for (int j = 0; j < i; j++)
- {
- Console.Write("*");
- }
- Console.WriteLine();
- }
- break;
- default:
- Console.WriteLine("Я такой команды не знаю");
- break;
- }
- }
- Console.WriteLine("Нажмите любую клавишу для выхода...");
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement