finally
This commit is contained in:
52
ArrayReverseWindow.xaml.cs
Normal file
52
ArrayReverseWindow.xaml.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user