在进行调试时,输入了数据,但在输出结果的时候,窗口突然消失了!但用逐步调试的时候却没有什么问题?求解!!
时间:2011-12-25
来源:互联网
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Class
{
class Program
{
static void Main(string[] args)
{
int x2 = int.Parse(Console.ReadLine());
int y2 = int.Parse(Console.ReadLine());
Point p1 = new Point();
Point p2 = new Point(x2, y2);
double distance = p1.DistanceTo(p2);
Console.WriteLine(distance);
}
}
}
新建一个类
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Class
{
class Point
{
private int x;
private int y;
public Point()
{
x = -1;
y = -1;
}
public Point(int z, int h)
{
x = z;
y = h;
}
public double DistanceTo(Point p)
{
int xdis = x - p.x;
int ydis = y - p.y;
return Math.Sqrt(xdis * xdis + ydis * ydis);
}
}
}
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Class
{
class Program
{
static void Main(string[] args)
{
int x2 = int.Parse(Console.ReadLine());
int y2 = int.Parse(Console.ReadLine());
Point p1 = new Point();
Point p2 = new Point(x2, y2);
double distance = p1.DistanceTo(p2);
Console.WriteLine(distance);
}
}
}
新建一个类
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Class
{
class Point
{
private int x;
private int y;
public Point()
{
x = -1;
y = -1;
}
public Point(int z, int h)
{
x = z;
y = h;
}
public double DistanceTo(Point p)
{
int xdis = x - p.x;
int ydis = y - p.y;
return Math.Sqrt(xdis * xdis + ydis * ydis);
}
}
}
作者: ToSurpassTesla 发布时间: 2011-12-25
Console.WriteLine(distance);
Console.ReadKey();
Console.ReadKey();
作者: wuyq11 发布时间: 2011-12-25
赞一个
引用 1 楼 wuyq11 的回复:
Console.WriteLine(distance);
Console.ReadKey();
Console.WriteLine(distance);
Console.ReadKey();
作者: kspaul 发布时间: 2011-12-25
相关阅读 更多
热门阅读
-
office 2019专业增强版最新2021版激活秘钥/序列号/激活码推荐 附激活工具
阅读:74
-
如何安装mysql8.0
阅读:31
-
Word快速设置标题样式步骤详解
阅读:28
-
20+道必知必会的Vue面试题(附答案解析)
阅读:37
-
HTML如何制作表单
阅读:22
-
百词斩可以改天数吗?当然可以,4个步骤轻松修改天数!
阅读:31
-
ET文件格式和XLS格式文件之间如何转化?
阅读:24
-
react和vue的区别及优缺点是什么
阅读:121
-
支付宝人脸识别如何关闭?
阅读:21
-
腾讯微云怎么修改照片或视频备份路径?
阅读:28