小编tsl*_*lid的帖子

检查特定点 x,y 是否在矩形内

我正在尝试编写程序,通过其宽度和高度及其左上角点来指定矩形。我希望程序允许用户输入点 x,y,然后我的目标是让程序确定该点是否在矩形内部。

到目前为止,这是我的代码,但我不确定如何继续。谁能帮助我实施bool Rectangle.Contains(x, y)

public struct Rectangle
{
    // declare the fields
    public int Width;
    public int Height;
    public int Top;
    public int Left;

    // define a constructor
    public Rectangle(int Width, int Height, int Top, int Left)
    {
        this.Width = Width;
        this.Height = Height;
        this.Top = Top;
        this.Left = Left;
    }

    public bool Contains(int x, int y) { }
}

class MainClass
{
    public static void Main()
    {
         Console.WriteLine("Creating a Rectangle instance");
         Rectangle myRectangle = new Rectangle(6, …
Run Code Online (Sandbox Code Playgroud)

c# geometry point rectangles

4
推荐指数
1
解决办法
2万
查看次数

Git结帐标记导致"当前不在任何分支上"

我通过标签结帐遇到了一个非常奇怪的问题.在将最新的更改从开发合并到master之后,我从master创建了一个标记并推送到远程.然后生产拉动成功,但当我签出标签并运行git状态我得到

目前不在任何分支机构

在我的本地计算机上,git status正确显示头部在特定标记处分离,例如1.0.0

git branch -v
* (no branch) ca992e2 Example commit message
develop     e945a50 Example commit message
master      ca992e2 Example commit message
Run Code Online (Sandbox Code Playgroud)

有小费吗?

git version-control git-tag

2
推荐指数
1
解决办法
849
查看次数

标签 统计

c# ×1

geometry ×1

git ×1

git-tag ×1

point ×1

rectangles ×1

version-control ×1