コード例 #1
0
ファイル: Program.cs プロジェクト: Liorkinn/FirstLab2.0
        static void Main()
        {
            Cafedra ad = new Cafedra();

            do
            {
                Console.WriteLine("[1]. Print information about employees.\n[2]. Output information about employees.\n[3]. Exit.");
                int i = int.Parse(Console.ReadLine());
                switch (i)
                {
                case 1:
                    int kol;
                    Console.WriteLine("Please, print number of employees to save information to the database: "); kol = Convert.ToInt32(Console.ReadLine());
                    for (int qqq = 0; qqq < kol; qqq++)
                    {
                        ad.Print();
                    }
                    break;

                case 2:
                    ad.Output();
                    break;

                case 3:
                    Environment.Exit(0);
                    break;

                default:
                    Console.WriteLine("Ошибка.");
                    break;
                }
            }  while(true);
        }
コード例 #2
0
ファイル: Class1.cs プロジェクト: Liorkinn/Refactoring
        public void Menu()
        {
            Cafedra cafedra = new Cafedra();

            do
            {
                Console.WriteLine("[1]. Print information about employees.\n[2]. Output information about employees.\n[3]. Exit.");
                int i = int.Parse(Console.ReadLine());
                switch (i)
                {
                case 1:
                    Console.WriteLine("Please, print number of employees to save information to the database: "); int h = Convert.ToInt32(Console.ReadLine());
                    for (int j = 0; j < h; j++)
                    {
                        cafedra.Print();
                    }
                    break;

                case 2:
                    cafedra.Output();
                    break;

                case 3:
                    Environment.Exit(0);
                    break;

                default:
                    Console.WriteLine("Ошибка.");
                    break;
                }
            } while (true);
        }