using System;
using System.Drawing;
namespace App
{
class Triangle
public Point A { get; }
public Point B { get; }
public Point C { get; }
public Triangle(int x1, int y1, int x2, int y2, int x3, int y3)
A = new Point(x1, y1);
B = new Point(x2, y2);
C = new Point(x3, y3);
}
public override string ToString() => $"A({A.X},{A.Y}); B({B.X},{B.Y}); C({C.X},{C.Y})";
class Program
static void Main(string[] args)
Triangle triangle = new Triangle(0, 0, 1, 2, 3, 2); // x1,y1,x2,y2,x3,y3
Console.WriteLine(triangle.ToString()); // Вывод: A(0,0); B(1,2); C(3,2)
Объяснение:
Print(1, 2);
Print("a", 'b');
Print(1, "a");
Print(true, "a", 1);
static void Print(params object[] values)
string result = "";
for (int i = 0; i < values.Length; i++)
result += values[i].ToString();
if (i + 1 < values.Length)
result += ", ";
Console.WriteLine(result);
using System;
using System.Drawing;
namespace App
{
class Triangle
{
public Point A { get; }
public Point B { get; }
public Point C { get; }
public Triangle(int x1, int y1, int x2, int y2, int x3, int y3)
{
A = new Point(x1, y1);
B = new Point(x2, y2);
C = new Point(x3, y3);
}
public override string ToString() => $"A({A.X},{A.Y}); B({B.X},{B.Y}); C({C.X},{C.Y})";
}
class Program
{
static void Main(string[] args)
{
Triangle triangle = new Triangle(0, 0, 1, 2, 3, 2); // x1,y1,x2,y2,x3,y3
Console.WriteLine(triangle.ToString()); // Вывод: A(0,0); B(1,2); C(3,2)
}
}
}
Объяснение:
using System;
namespace App
{
class Program
{
static void Main(string[] args)
{
Print(1, 2);
Print("a", 'b');
Print(1, "a");
Print(true, "a", 1);
}
static void Print(params object[] values)
{
string result = "";
for (int i = 0; i < values.Length; i++)
{
result += values[i].ToString();
if (i + 1 < values.Length)
result += ", ";
}
Console.WriteLine(result);
}
}
}