added doga
This commit is contained in:
95
20240108_doga/ConsoleApp2/Program.cs
Normal file
95
20240108_doga/ConsoleApp2/Program.cs
Normal file
@@ -0,0 +1,95 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
// Szabó Márton 12/B
|
||||
// A csoport
|
||||
|
||||
namespace ConsoleApp2
|
||||
{
|
||||
public class Haromszog
|
||||
{
|
||||
public double Ax, Ay, Bx, By, Cx, Cy;
|
||||
public double aoldal, boldal, coldal;
|
||||
|
||||
public Haromszog(double ax , double ay, double bx, double by, double cx, double cy)
|
||||
{
|
||||
Ax = ax;
|
||||
Ay = ay;
|
||||
Bx = bx;
|
||||
By = by;
|
||||
Cx = cx;
|
||||
Cy = cy;
|
||||
aoldal = System.Math.Sqrt((bx - cx) * (bx - cx) + (by - cy) * (by - cy));
|
||||
boldal = System.Math.Sqrt((ax - cx) * (ax - cx) + (ay - cy) * (ay - cy));
|
||||
coldal = System.Math.Sqrt((bx - ax) * (bx - ax) + (by - ay) * (by - ay));
|
||||
}
|
||||
|
||||
public void Szabalyossag()
|
||||
{
|
||||
if (aoldal == boldal && boldal == coldal)
|
||||
{
|
||||
Console.WriteLine("Ez egy szabályos háromszög.");
|
||||
} else if (aoldal == boldal || aoldal == coldal || boldal == coldal){
|
||||
Console.WriteLine("Ez egy egyenlő szárú háromszög.");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Ez a háromszög nem egyenlő szárú és nem is szabályos.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public double Kerület()
|
||||
{
|
||||
return aoldal + boldal + coldal;
|
||||
}
|
||||
|
||||
public double Terület()
|
||||
{
|
||||
return 0.5 * System.Math.Abs(Ax * (By - Cy) + Bx * (Cy - Ay) + Cx * (Ay - By));
|
||||
}
|
||||
}
|
||||
|
||||
class Haromszogellenorzo
|
||||
{
|
||||
public double a, b, c, d, e, f;
|
||||
|
||||
public void Ell()
|
||||
{
|
||||
Haromszog harom = new Haromszog(a, b, c, d, e, f);
|
||||
harom.Szabalyossag();
|
||||
Console.WriteLine(harom.Kerület());
|
||||
Console.WriteLine(harom.Terület());
|
||||
Console.WriteLine(harom.aoldal);
|
||||
Console.WriteLine(harom.boldal);
|
||||
Console.WriteLine(harom.coldal);
|
||||
}
|
||||
|
||||
public Haromszogellenorzo()
|
||||
{
|
||||
Console.WriteLine("Adjon meg az A csúcs x koordinátáját!");
|
||||
a = Convert.ToDouble(Console.ReadLine());
|
||||
Console.WriteLine("Adjon meg az A csúcs y koordinátáját!");
|
||||
b = Convert.ToDouble(Console.ReadLine());
|
||||
Console.WriteLine("Adjon meg az B csúcs x koordinátáját!");
|
||||
c = Convert.ToDouble(Console.ReadLine());
|
||||
Console.WriteLine("Adjon meg az B csúcs y koordinátáját!");
|
||||
d = Convert.ToDouble(Console.ReadLine());
|
||||
Console.WriteLine("Adjon meg az C csúcs x koordinátáját!");
|
||||
e = Convert.ToDouble(Console.ReadLine());
|
||||
Console.WriteLine("Adjon meg az C csúcs y koordinátáját!");
|
||||
f = Convert.ToDouble(Console.ReadLine());
|
||||
}
|
||||
}
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Haromszogellenorzo ell = new Haromszogellenorzo();
|
||||
ell.Ell();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user