创建圆形类,其中包括set,get方法
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace 圆
{
class circle
{
int center_x;
int center_y;
double Radius;
public int x
{
get { return center_x; }
set { center_x = value; }
}
public int y
{
get { return center_y; }
set { center_y = value; }
}
public double radius
{
get { return Radius; }
set { Radius = value; }
}
}
class Program
{
static void Main(string[] args)
{
circle myCircle = new circle();
myCircle.x = 10;
myCircle.y = 10;
myCircle.radius = 8;
Console.WriteLine("Center:({0},{1})", myCircle.x, myCircle.y);
Console.WriteLine("Radius:{0}", myCircle.radius);
Console.WriteLine("Circumference:{0}", (double)(2 * 3.141592653 * myCircle.radius));
Console.ReadKey();
}
}
}