当前位置: 首页>>代码示例>>C#>>正文


C# Point3D.ToString方法代码示例

本文整理汇总了C#中Point3D.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Point3D.ToString方法的具体用法?C# Point3D.ToString怎么用?C# Point3D.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Point3D的用法示例。


在下文中一共展示了Point3D.ToString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main

 static void Main()
 {
     //Task 1 test
     Console.WriteLine("Task 1 test:");
     Point3D justPoint = new Point3D();
     Console.WriteLine(justPoint.ToString());
     justPoint = new Point3D(1, 2, 3);
     Console.WriteLine(justPoint.ToString());
     Console.WriteLine();
     Console.WriteLine("Task 2 test:");
     //Task 2 test
     justPoint = Point3D.Point0;
     Console.WriteLine(justPoint.ToString());
     Console.WriteLine();
     Console.WriteLine("Task 3 test:");
     //Task 3 test
     Point3D otherPoint = new Point3D(1, 2, 3);
     Console.WriteLine(Space3D.CalculateDistance(justPoint, otherPoint));
     Console.WriteLine();
     Console.WriteLine("Task 4 test:");
     //Task 4 test
     Path firstPath = new Path();
     firstPath.AddPoint(justPoint);
     firstPath.AddPoint(otherPoint);
     Path secondPath = new Path();
     secondPath.AddPoint(11, 22, 33);
     secondPath.AddPoint(77, 88, 99);
     secondPath.AddPoint(55, 31, 73);
     PathStorage.AddPath(firstPath);
     PathStorage.AddPath(secondPath);
     Console.WriteLine(PathStorage.PrintAllPaths());
     PathStorage.LoadFromFile("3Dpaths.txt");
     //PathStorage.SaveToFile("result.txt");
     Console.WriteLine(PathStorage.PrintAllPaths());
 }
开发者ID:KirilToshev,项目名称:Projects,代码行数:35,代码来源:Point3DTest.cs

示例2: Main

 static void Main()
 {
     Console.WriteLine("------------------------------Ex.1------------------------------");
     Point3D point = new Point3D(10, 20, 30);
     Console.Write("Override ToString(): ");
     Console.WriteLine(point.ToString());
     //ex2
     Console.WriteLine("------------------------------Ex.2------------------------------");
     Console.WriteLine(Point3D.PointO);
     //ex3
     Console.WriteLine("------------------------------Ex.3------------------------------");
     Console.Write("Distance : ");
     Point3D point1 = new Point3D(0,0,0);
     Point3D point2 = new Point3D(0,3,4);
     Console.WriteLine(CalculateDistance.Calc(point1,point2));
     Console.WriteLine("------------------------------Ex.4------------------------------");
     Path path = new Path();
     path.AddInPath(point1);
     path.AddInPath(point2);
     Console.WriteLine(path.Points[0]);
     PathStorage.SaveData(path);
     Path loadedPath = new Path();
     loadedPath = PathStorage.LoadData();
     Console.WriteLine("The loaded path has points :");
     foreach (var item in loadedPath.Points)
     {
         Console.WriteLine(item);
     }
 }
开发者ID:naturalna,项目名称:OOPPrinciples,代码行数:29,代码来源:PointThreeD.cs

示例3: Main

    static void Main()
    {
        var point = new Point3D(1, 3, 7);
        Console.WriteLine(point.ToString());

        Console.WriteLine(Point3D.StartingPoint);
    }
开发者ID:i-yotov,项目名称:Courses,代码行数:7,代码来源:Program.cs

示例4: Main

 static void Main(string[] args)
 {
     Point2D<int> dot2D = new Point2D<int>(10, 20);
     dot2D.ToString();
     Point3D dot3D = new Point3D(10, 20, 30);
     dot3D.ToString();
 }
开发者ID:makmen,项目名称:itstep-C-,代码行数:7,代码来源:Program.cs

示例5: Main

        static void Main(string[] args)
        {
            // For Problem 1
            Point3D one = new Point3D(3, 4, 5);
            Point3D two = new Point3D(6, 7, 8);

            Console.WriteLine(Point3D.StartPoint());
            Console.WriteLine(one.ToString());
            Console.WriteLine(two.ToString());
            Console.WriteLine();

            // For Problem 2
            DistanceCalculator.CalculateDistance(one, two);
            Console.WriteLine();

            // For Problem 3 (You have to create a file C:\temp\Input.txt to read the input data from or change the path in the Storage class)
            List<Point3D> path = Storage.ReadData();

            foreach (var point in path)
            {
                Console.WriteLine(point.ToString());
            }

            Storage.WriteData(path);
        }
开发者ID:ImarKelam,项目名称:OOP,代码行数:25,代码来源:Test_points.cs

示例6: DistancePoints

 public static void DistancePoints(Point3D firstPoint, Point3D secondPoint)
 {
     double distance = Math.Sqrt((secondPoint.X - firstPoint.X) * (secondPoint.X - firstPoint.X) +
                                  (secondPoint.Y - firstPoint.Y) * (secondPoint.Y - firstPoint.Y) +
                                  (secondPoint.Z - firstPoint.Z) * (secondPoint.Z - firstPoint.Z));
     Console.WriteLine("Distance between point A:{0} and point B:{1} is: {2:0.00}", firstPoint.ToString(), secondPoint.ToString(), distance);
 }
开发者ID:ReniGetskova,项目名称:CSharp-OOP,代码行数:7,代码来源:Distance.cs

示例7: Main

 private static void Main()
 {
     Point3D point = new Point3D(2, 4, 6);
     Point3D pointTwo = new Point3D(8, 5, 3);
     Console.WriteLine("First point:");
     Console.WriteLine(point.ToString());
     Console.WriteLine();
     Console.WriteLine("Second point:");
     Console.WriteLine(pointTwo.ToString());
     Console.WriteLine();
     Console.WriteLine("Distance:");
     Console.WriteLine(DistanceTwo3DPoints.CalcDistance(point, pointTwo));
     Console.WriteLine();
     Console.WriteLine("Center of coordinate system:");
     Console.WriteLine(Point3D.zero.ToString());
     Console.WriteLine();
     Console.WriteLine("Writing in file \"Paths.txt\" first point, second point, first point again!");
     Path firstPath = new Path();
     firstPath.AddPoint(pointTwo);
     firstPath.AddPoint(point);
     firstPath.AddPoint(pointTwo);
     PathStorage.SavePath(firstPath);
     Console.WriteLine("File is saved");
     Console.WriteLine();
     Console.WriteLine("Loading points from file \"Paths.txt\"");
     List<Path> pathList = PathStorage.LoadPath();
     foreach (var path in pathList)
     {
         foreach (var pointers in path.Paths)
         {
             Console.WriteLine(pointers);
         }
     }
 }
开发者ID:kancho-kanchev,项目名称:Telerik,代码行数:34,代码来源:00.Point3dProject.cs

示例8: Main

 static void Main(string[] args)
 {
     Point3D proba = new Point3D(2, 3, 5.8);
     proba.ToString();
     StreamReader pointRead = new StreamReader(@"..\..\..\Points.txt");
     StreamWriter pointWrite = new StreamWriter(@"..\..\..\Save.txt");
     Path.Read(pointRead, pointWrite);
 }
开发者ID:Ivan-Dimitrov-bg,项目名称:.Net-framework,代码行数:8,代码来源:DefineClassII.cs

示例9: TestToString

        public void TestToString()
        {
            Point3D firstPoint = new Point3D(3, 4, 5);

            var expected = "X: 3 Y: 4 Z: 5";
            var actual = firstPoint.ToString();

            Assert.AreEqual(expected, actual);
        }
开发者ID:rnikiforova,项目名称:TelerikAcademy,代码行数:9,代码来源:UnitTest1.cs

示例10: ToStringTest

        public void ToStringTest()
        {
            Point1D<int> point1 = new Point1D<int>(5);
            Point2D<int> point2 = new Point2D<int>(10, 0);
            Point3D<int> point3 = new Point3D<int>(15, 16, 17);

            Assert.AreEqual(point1.ToString(),"X: 5\n");
            Assert.AreEqual(point2.ToString(), "X: 10,Y: 0\n");
            Assert.AreEqual(point3.ToString(), "X: 15,Y: 16,Z: 17\n");
        }
开发者ID:DmytroKarpa,项目名称:Projects,代码行数:10,代码来源:PointTest.cs

示例11: Main

        static void Main()
        {
            Point3D point1 = new Point3D(1, 2, 3);
            Point3D point0 = new Point3D(0, 0, 0);

            string test = point1.ToString();
            Console.WriteLine(test);

            CalculateDistance.Calc(Point3D.GetStart(), point1);
        }
开发者ID:BobbyBorisov,项目名称:TelerikAcademy,代码行数:10,代码来源:TestPoint3D.cs

示例12: Main

    static void Main()
    {
        //Create a structure Point3D to hold a 3D-coordinate {X, Y, Z} in the Euclidian 3D space. Implement the ToString() to enable printing a 3D point.

        Point3D tochka = new Point3D(2, 3, 4);
        Point3D tochka2 = new Point3D();
        Console.WriteLine(tochka2.ToString());
        Console.WriteLine( tochka.ToString());

        Console.WriteLine( Distance.Calculate(tochka, tochka2));
    }
开发者ID:hackohackob,项目名称:TelerikAcademy,代码行数:11,代码来源:Point.cs

示例13: Main

 static void Main()
 {
     Console.WriteLine("Enter point abscissa");
     int abscissa = int.Parse(Console.ReadLine());
     Console.WriteLine("Enter point ordinate");
     int ordinate = int.Parse(Console.ReadLine());
     Console.WriteLine("Enter point dimension");
     int dimension = int.Parse(Console.ReadLine());
     Point3D point = new Point3D(abscissa, ordinate, dimension);
     Console.WriteLine(point.ToString());
 }
开发者ID:vasilkrvasilev,项目名称:ObjectOrientedProgramming,代码行数:11,代码来源:PrintPoint.cs

示例14: Main

    public static void Main()
    {
        //From Problem 1 to 4:
        Console.WriteLine(new string('=', 40));
        Console.WriteLine("Coordinates problem");
        Console.WriteLine(new string('=', 40));
        var point = new Point3D(6, 9, 72);
        var anotherPoint = new Point3D(5, 21, 4);
        var yetAnotherPoint = Point3D.StartPoint;
        double distance = CalculatingDistance.CalculateDistanceBetweenPoints(point, anotherPoint);
        Console.WriteLine("Distance between\nPoint: {0}\nPoint: {1}\nIs ==> {2:F3}", point.ToString(), anotherPoint.ToString(), distance);
        PathStorage.SavePath(anotherPoint);
        PathStorage.SavePath(point);
        PathStorage.SavePath(new Point3D(3, 5, 6));

        var listOfPoints = PathStorage.LoadPaths(@"..\..\Files\Paths.txt");
        Console.WriteLine("Paths stored in text file:");
        for (int i = 0; i < listOfPoints.Count; i++)
        {
            Console.WriteLine("Line {0, -3} : {1}", i + 1, listOfPoints[i]);
        }

        //From Problem 5 to 7:

        Console.WriteLine(new string('=', 40));
        Console.WriteLine("Now Generics");
        Console.WriteLine(new string('=', 40));
        var elementsOfStrings = new GenericList<string>();

        elementsOfStrings.Add("ABC");
        elementsOfStrings.Add("A");
        elementsOfStrings.Add("c");
        elementsOfStrings.Add("KEkE");
        elementsOfStrings.Add("HI");
        Console.WriteLine("Before:");
        Console.WriteLine(elementsOfStrings.ToString());
        Console.WriteLine("After:");
        elementsOfStrings.InsertAt(3, "Just another test!");
        elementsOfStrings.RemoveAt(0);
        Console.WriteLine(elementsOfStrings.ToString());

        var indexOfTest = elementsOfStrings.IndexOf("HI");
        var minElement = elementsOfStrings.Min();
        var maxElement = elementsOfStrings.Max();

        Console.WriteLine(@"
        IndexOf ""HI"" is {0}
        Min element is {1}
        Max element is {2}", indexOfTest, minElement, maxElement);

        elementsOfStrings.Clear();
        Console.WriteLine(new string('=', 40));
    }
开发者ID:nikistefanov,项目名称:Telerik-Academy-Homework,代码行数:53,代码来源:DefiningClassesMain.cs

示例15: Main

    static void Main()
    {
        Point3D pointA = new Point3D(3.5, 2, 4.86);
        Point3D pointB = new Point3D(10, 5.2, 15);

        Console.WriteLine(pointA.ToString());
        Console.WriteLine(pointB.ToString());
        Console.WriteLine(Point3D.StartingPoint);

        Console.WriteLine(String.Format("{0:0.##}", DistanceCalculator.distCalculator(pointA, pointB)));

        Path3D path = new Path3D(pointA, pointB, Point3D.StartingPoint);
        Console.WriteLine("{0}", path);
    }
开发者ID:bnaskov,项目名称:SoftUni,代码行数:14,代码来源:Demo.cs


注:本文中的Point3D.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。