finally
This commit is contained in:
53
TriangleWindow.xaml.cs
Normal file
53
TriangleWindow.xaml.cs
Normal file
@@ -0,0 +1,53 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
|
||||
namespace Lab
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for TriangleWindow.xaml
|
||||
/// </summary>
|
||||
|
||||
|
||||
public partial class TriangleWindow : Window
|
||||
{
|
||||
private void ClickCheck(object sender, RoutedEventArgs e) {
|
||||
if (!Parsers.TryParseDouble(XBox.Text, out double x) ||
|
||||
!Parsers.TryParseDouble(YBox.Text, out double y) ||
|
||||
!Parsers.TryParseDouble(ZBox.Text, out double z))
|
||||
{
|
||||
ResultText.Text = "Введите три положительных числа (например: 2.5).";
|
||||
return;
|
||||
}
|
||||
|
||||
if (x <=0 ||
|
||||
y <=0 ||
|
||||
z <=0)
|
||||
{
|
||||
ResultText.Text = "Стороны должны быть строго положительными.";
|
||||
return;
|
||||
}
|
||||
|
||||
bool check = x + y > z && x + z > y && y + z > x;
|
||||
|
||||
ResultText.Text = check ? "Треугольник существует." :
|
||||
"Треугольник не существует.";
|
||||
}
|
||||
private void ClickBack(object sender, RoutedEventArgs e) => Close();
|
||||
|
||||
public TriangleWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user