using System;
namespace CSharpPractice
{
struct Rectangle
{
public int xLeftTop;//左上角横坐标
public int yLeftTop;//左上角纵坐标
public int width; //矩形的宽
public int height; //矩形的高
public Rectangle(int x, int y, int w, int h)
{
xLeftTop = x;
yLeftTop = y;
width = w;
height = h;
}
}
class Program
{
static void Main(string[] args)
{
Rectangle rect;
rect.xLeftTop = 20;
rect.yLeftTop = 30;
rect.width = 200;
rect.height = 300;
Console.WriteLine("xLeftTop = {0}, yLeftTop = {1}\nwidth = {2}, height = {3}", rect.xLeftTop, rect.yLeftTop, rect.width, rect.height);
}
}
}
C#第二章1
最新推荐文章于 2019-11-15 15:31:20 发布