1
0
Files
OAiP-Presnyakov_Ilya-Labora…/ArrayReverseWindow.xaml.cs
Debug_pro 43d7845cf1 finally
2026-02-12 01:01:44 +03:00

53 lines
1.4 KiB
C#

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 ArrayReverseWindow.xaml
/// </summary>
public partial class ArrayReverseWindow : Window
{
private void ClickBack(object sender, RoutedEventArgs e) => Close();
private void ClickClear(object sender, RoutedEventArgs e)
{
ArrayInBox.Clear();
ArrayOutBox.Clear();
ArrayInfoText.Text = "";
}
private void ClickReverse(object sender, RoutedEventArgs e)
{
ArrayOutBox.Clear();
ArrayInfoText.Text = "";
if (!Parsers.TryParseDoubleArray(ArrayInBox.Text, out double[] vals, out string err))
{
ArrayInfoText.Text = err;
return;
}
for(int i=0,j=vals.Length-1;i<j;i++,j--)(vals[i],vals[j])=(vals[j],vals[i]);
ArrayOutBox.Text = string.Join(", ", vals);
ArrayInfoText.Text = $"Готово. Длина массива: {vals.Length}.";
}
public ArrayReverseWindow()
{
InitializeComponent();
}
}
}