Beispiel #1
0
    static void Main(string[] args)
    {
        Solve people = new Solve();
        int   n      = int.Parse(Console.ReadLine());

        for (int i = 0; i < n; i++)
        {
            string[] tokens = Console.ReadLine().Split(' ');
            people.AddPeople(new Person(tokens[0], int.Parse(tokens[1])));
        }
        foreach (var person in people.GetResult())
        {
            Console.WriteLine($"{person.Name} - {person.Age}");
        }
    }
        public void RandomTests()
        {
            Random rand = new Random();

            for (int i = 0; i < 100; i++)
            {
                GeometryBasicsDistanceBetweenCirclesIn2D.Circle a =
                    new GeometryBasicsDistanceBetweenCirclesIn2D.Circle(
                        new Point(rand.Next(-50, 50), rand.Next(-50, 50)), rand.Next(1, 50));
                GeometryBasicsDistanceBetweenCirclesIn2D.Circle b =
                    new GeometryBasicsDistanceBetweenCirclesIn2D.Circle(
                        new Point(rand.Next(-50, 50), rand.Next(-50, 50)), rand.Next(1, 50));
                Assert.AreEqual(Math.Round(Solve.GetResult(a, b), 6),
                                Math.Round(GeometryBasicsDistanceBetweenCirclesIn2D.DistanceBetweenCircles(a, b), 6));
            }
        }
Beispiel #3
0
        static void Main(string[] args)
        {
            Console.WriteLine("请输入你需要的四则运算数量:");
            String        TotalNum = Console.ReadLine();
            int           num      = Convert.ToInt32(TotalNum);
            Solve         s        = new Solve();
            StringBuilder sb       = new StringBuilder();
            WriteInTxt    wt       = new WriteInTxt();

            Console.WriteLine("打印数据中,请等待……");
            //获取题目数量
            while (num > 0)
            {
                string result = s.GetResult();
                Console.WriteLine(result);
                sb.Append(result).Append("\r\n");
                num--;
            }
            //写入文件
            wt.WriteTxt(sb.ToString());
        }
Beispiel #4
0
        public void GetResultTest()
        {
            string TestResult = solve.GetResult();

            Assert.IsNotNull(TestResult);
        }