Exemplo n.º 1
0
        public static void RoundExample()
        {
            Round round = new Round(1, 1, 10);

            Console.WriteLine($"Length: {round.Length(): 0.###}\n" +
                              $"Area: {round.Area(): 0.###}\n");
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            Round c1 = new Round();
            Round c2 = new Round();

            Console.WriteLine("Введите данные первого круга:");
            ReadRound(ref c1);
            Console.WriteLine("Введите данные второго круга:");
            ReadRound(ref c2);
            Console.WriteLine(Contact(c1, c2));
            Console.WriteLine();
            Console.WriteLine();
            Console.WriteLine("Площадь первого круга : {0} Площадь второго круга: {1}", Math.Round(c1.Area()), Math.Round(c2.Area()));
            Console.WriteLine();
            Console.WriteLine("Периметр первого круга : {0} Периметр второго круга: {1}", Math.Round(c1.Length()), Math.Round(c2.Length()));
            Console.ReadKey();
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            var round = new Round();
            Console.WriteLine("Выберите действие с кругом: ");
            do
            {
                int num; double value;
                Console.WriteLine("1. Задать координаты и радиус.");
                Console.WriteLine("2. Вычислить длину окружности.");
                Console.WriteLine("3. Вычислить площадь круга.");
                num = int.Parse(Console.ReadLine());
                switch (num)
                {
                    case 1:
                        Console.WriteLine("Введите х=");
                        round.setx(double.Parse(Console.ReadLine()));

                        Console.WriteLine("Введите y=");
                        round.sety(double.Parse(Console.ReadLine()));

                        do
                        {
                            Console.WriteLine("Введите неотрицательное значение r=");
                            value = double.Parse(Console.ReadLine());
                        } while (value < 0);
                        round.setr(value);

                        break;
                    case 2:
                        Console.WriteLine("Длина окружности L=" + round.Length());
                        break;
                    case 3:
                        Console.WriteLine("Площадь круга S=" + round.Square());
                        break;
                }
            } while (true);
        }
Exemplo n.º 4
0
        static void Main(string[] args)
        {
            Round c1 = new Round();
            Round c2 = new Round();

            Console.WriteLine("Введите данные первого круга:");
            ReadRound(ref c1);
            Console.WriteLine("Введите данные второго круга:");
            ReadRound(ref c2);
            Console.WriteLine(Contact(c1, c2));
            Console.WriteLine();
            Console.WriteLine();
            Console.WriteLine("Площадь первого круга : {0} Площадь второго круга: {1}", Math.Round(c1.Area()), Math.Round(c2.Area()));
            Console.WriteLine();
            Console.WriteLine("Периметр первого круга : {0} Периметр второго круга: {1}", Math.Round(c1.Length()), Math.Round(c2.Length()));
            Console.ReadKey();
        }