2
Reply

error 1 - Invalid expression term "(CS1525) and error 2 - ; expected(CS1002)

asawari.teredesai

asawari.teredesai

Sep 3 2004 10:07 AM
14.1k
Hi I'm getting above 2 errors while compiling a simple C# code. Can anyone help me? Thanks.... ------------------------------------------------------------------------ // created on 9/3/2004 at 6:45 PM using System; class Point { public double x, y; public Point() { this.x = 0; this.y = 0; } public Point(double x, double y) { this.x = x; this.y = y; } public static double Distance(Point a, Point b) { double xdiff = a.x – b.x; double ydiff = a.y – b.y; return Math.Sqrt(xdiff * xdiff + ydiff * ydiff); } public override string ToString() { return string.Format("({0}, {1})", x, y); } } class Test { static void Main() { Point a = new Point(); Point b = new Point(3, 4); double d = Point.Distance(a, b); Console.WriteLine("Distance from {0} to {1} is {2}", a, b, d); } } -------------------------------------------------------------------------------------

Answers (2)