0
我想要求用户重新输入,如果有异常cathced,但不知道如何:我输入如果再次例外逮住
class Quadrilateral
{
Point[] pointsArr = new Point[4];
public Quadrilateral()
{
foreach (Point pointVar in pointsArr)
{
try
{
Console.WriteLine("Input coordinates:");
float x = float.Parse(Console.ReadLine());
float y = float.Parse(Console.ReadLine());
}
catch (FormatException)
{
Console.WriteLine("Illegal value, please re-input");
}
}
}
}
想到用do-while循环,但有一些问题的它。