Advertisement
DrSmile

Создание меню

Jun 17th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.35 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApp10
  8. {
  9.     class Program
  10.     {
  11.  
  12.         static void Menu()
  13.         {
  14.             int n = 1;
  15.             while (n != 0)
  16.             {
  17.  
  18.                 Console.WriteLine("Введите команду: ");
  19.                 Console.WriteLine("1. ");
  20.                 Console.WriteLine("2. ");
  21.                 Console.WriteLine("3. ");
  22.                 Console.WriteLine("0. ");
  23.                 n = int.Parse(Console.ReadLine());
  24.  
  25.                 switch (n)
  26.                 {
  27.                     case 1:
  28.                         Console.WriteLine("Вы ввели 1");
  29.                         break;
  30.                     case 2:
  31.                         Console.WriteLine("Вы ввели 2");
  32.                         break;
  33.                     case 3:
  34.                         Console.WriteLine("Вы ввели 3");
  35.                         break;
  36.                     case 0:
  37.                         break;
  38.                     default:
  39.                         Console.WriteLine("Вы ввели неверное значение");
  40.                         break;
  41.  
  42.  
  43.                 }
  44.             }
  45.         }
  46.  
  47.  
  48.  
  49.  
  50.         static void Main(string[] args)
  51.         {
  52.             Menu();
  53.  
  54.  
  55.         }
  56.  
  57.  
  58.     }
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement