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);
}
}
}
void main(){ setlocale(0, ""); int a = 100, num, player = 1, correct; while (a > 0) { if (player == 1) { do { cout << "Ваш ход. На столе " << a <<" спичек" << endl; cout << "Сколько спичек вы берете?" << endl; cin >> num; if ((num > 0) && (num <= 10)) { correct = true; } } while (correct != true); } else { if ((a <= 10) && (a > 1)) { num = a - 1; } else if (a == 1) { num = 1; } else { if (num > a) { num = a; } } cout << "Компьютер взял " << num << " спичек" << endl; } a = a - num; if (player == 1) { player = 2; } else { player = 1; } } if (player == 1) { cout << "Вы проиграли" << endl; } else cout << "Вы победили" << endl; system("pause");}