예제 #1
0
        static void Main(string[] args)
        {
            try
            {
                Box a = new Box();

                Console.WriteLine("Type position of the box, x = ");
                a.X = uint.Parse(Console.ReadLine());

                Console.WriteLine("Type position of the box: y = ");
                a.Y = uint.Parse(Console.ReadLine());

                Console.WriteLine("Type width of the box: width = ");
                a.Width = uint.Parse(Console.ReadLine());

                Console.WriteLine("Type height of the box: height = ");
                a.Height = uint.Parse(Console.ReadLine());

                Console.WriteLine("Type symbol (*,+,$,#,@) :");
                a.Symbol = char.Parse(Console.ReadLine());

                Console.WriteLine("Type the message : ");
                a.Message = Console.ReadLine();

                a.Draw();

                Console.WriteLine(a.Message);
                Console.WriteLine();

                Console.WriteLine("Type integer value:");
                Console.WriteLine("Factorial = {0}", factorial(int.Parse(Console.ReadLine())));
                Console.ReadLine();

            }
            catch (Exception)
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("invalid parameters!");
                Console.ReadLine();
            }
        }
예제 #2
0
파일: Program.cs 프로젝트: vimaks/Course
        static void Main(string[] args)
        {
            try
            {
                //Implement start position, width and height, symbol, message input

                Console.WriteLine("Input startPositionX");
                int startPositionX = InputInt();

                Console.WriteLine("Input startPositionY");
                int startPositionY = InputInt();
                Console.WriteLine("Input width border");
                int width = InputInt();
                Console.WriteLine("Input height border");
                int height = InputInt();
                Console.WriteLine("Input char value '*', '+', '.' for border");
                char symbol = InputCharForBorder();
                Console.WriteLine(" Input Message");
                string mesage = Console.ReadLine();


                //Create Box class instance
                Box box = new Box();
                box.StartPositionX = startPositionX;
                box.StartPositionY = startPositionY;
                box.Width          = width;
                box.Height         = height;
                box.Symbol         = symbol;
                box.Message        = mesage;
                //Use  Box.Draw() method
                box.Draw();
                Console.WriteLine("Press any key...");
                Console.ReadLine();
            }
            catch (Exception)
            {
                Console.WriteLine("Error!");
            }
        }
예제 #3
0
        static void Main(string[] args)
        {
            try
            {
                //Implement start position, width and height, symbol, message input

                //Create Box class instance
                Box box = new Box();
                box.Draw();
                //Use  Box.Draw() method



                Console.WriteLine("");
                Console.WriteLine("Press any key...");
                Console.ReadLine();
            }
            catch (Exception)
            {
                Console.WriteLine("Error!");
            }
        }
예제 #4
0
        static void Main(string[] args)
        {
            //int width = 0;
            //int height = 0;
            //int x = 0, y = 0;
            //string symbol;


            //Console.Write("Ширина: ");
            //height = int.Parse(Console.ReadLine());
            //Console.Write("Высота: ");
            //width = int.Parse(Console.ReadLine());
            //Console.Write("Отступ справа: ");
            //x = int.Parse(Console.ReadLine());
            //Console.Write("Отступ сверху: ");
            //y = int.Parse(Console.ReadLine());
            //Console.Write("Введите символ, каким рисовать прямоугольник: ");
            //symbol = Convert.ToString(Console.ReadLine());
            //// Console.SetWindowSize(130, 70); // установка ширины и высоты консоли

            //Console.Clear();
            //// Console.SetCursorPosition(2, 2);

            //for (int j = 0; j < height; j++)
            //{
            //    for (int i = 0; i < width; i++)
            //    {
            //        if (j == 0 || j == height - 1)
            //        {
            //            Console.SetCursorPosition(x+j, y+i);
            //            Console.Write(symbol);
            //        }
            //        else if (i == 0 || i == width - 1)
            //        {
            //            Console.SetCursorPosition(x+j,y+i);
            //            Console.Write(symbol);
            //        }
            //        else
            //        {
            //            Console.SetCursorPosition(x+j,y+i);
            //            Console.Write(" ");
            //        }
            //    }
            //    Console.WriteLine();
            //}

            int wid = Console.WindowWidth;  //ширина консоли
            int hei = Console.WindowHeight; //высота консоли

            Console.WriteLine($"высота{hei}  ширина{wid}");
            try
            {
                //Implement start position, width and height, symbol, message input
                Box box = new Box();
                box.Draw(5, 15, 5, 5, "+");
                //Create Box class instance

                //Use  Box.Draw() method

                Console.WriteLine("Press any key...");
                Console.ReadLine();
            }
            catch (Exception)
            {
                Console.WriteLine("Error!");
            }
        }