From 43d7845cf1aa511dd751ff8f91f7c89da949f172 Mon Sep 17 00:00:00 2001
From: Debug_pro <63473508+Debug-pro-dev@users.noreply.github.com>
Date: Thu, 12 Feb 2026 01:01:44 +0300
Subject: [PATCH] finally
---
.gitignore | 363 ++++++++++++++++++++++++++++++++++++
App.xaml | 9 +
App.xaml.cs | 14 ++
ArrayReverseWindow.xaml | 42 +++++
ArrayReverseWindow.xaml.cs | 52 ++++++
AssemblyInfo.cs | 10 +
ClassMultiplyWindow.xaml | 53 ++++++
ClassMultiplyWindow.xaml.cs | 72 +++++++
FibonacciWindow.xaml | 43 +++++
FibonacciWindow.xaml.cs | 49 +++++
Lab.csproj | 11 ++
Lab.sln | 25 +++
MainWindow.xaml | 41 ++++
MainWindow.xaml.cs | 39 ++++
Matrices.cs | 106 +++++++++++
MatrixCompareWindow.xaml | 42 +++++
MatrixCompareWindow.xaml.cs | 62 ++++++
MatrixFlipWindow.xaml | 43 +++++
MatrixFlipWindow.xaml.cs | 94 ++++++++++
Parsers.cs | 44 +++++
SplitNumber.cs | 37 ++++
TriangleWindow.xaml | 49 +++++
TriangleWindow.xaml.cs | 53 ++++++
23 files changed, 1353 insertions(+)
create mode 100644 .gitignore
create mode 100644 App.xaml
create mode 100644 App.xaml.cs
create mode 100644 ArrayReverseWindow.xaml
create mode 100644 ArrayReverseWindow.xaml.cs
create mode 100644 AssemblyInfo.cs
create mode 100644 ClassMultiplyWindow.xaml
create mode 100644 ClassMultiplyWindow.xaml.cs
create mode 100644 FibonacciWindow.xaml
create mode 100644 FibonacciWindow.xaml.cs
create mode 100644 Lab.csproj
create mode 100644 Lab.sln
create mode 100644 MainWindow.xaml
create mode 100644 MainWindow.xaml.cs
create mode 100644 Matrices.cs
create mode 100644 MatrixCompareWindow.xaml
create mode 100644 MatrixCompareWindow.xaml.cs
create mode 100644 MatrixFlipWindow.xaml
create mode 100644 MatrixFlipWindow.xaml.cs
create mode 100644 Parsers.cs
create mode 100644 SplitNumber.cs
create mode 100644 TriangleWindow.xaml
create mode 100644 TriangleWindow.xaml.cs
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..9491a2f
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,363 @@
+## Ignore Visual Studio temporary files, build results, and
+## files generated by popular Visual Studio add-ons.
+##
+## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
+
+# User-specific files
+*.rsuser
+*.suo
+*.user
+*.userosscache
+*.sln.docstates
+
+# User-specific files (MonoDevelop/Xamarin Studio)
+*.userprefs
+
+# Mono auto generated files
+mono_crash.*
+
+# Build results
+[Dd]ebug/
+[Dd]ebugPublic/
+[Rr]elease/
+[Rr]eleases/
+x64/
+x86/
+[Ww][Ii][Nn]32/
+[Aa][Rr][Mm]/
+[Aa][Rr][Mm]64/
+bld/
+[Bb]in/
+[Oo]bj/
+[Oo]ut/
+[Ll]og/
+[Ll]ogs/
+
+# Visual Studio 2015/2017 cache/options directory
+.vs/
+# Uncomment if you have tasks that create the project's static files in wwwroot
+#wwwroot/
+
+# Visual Studio 2017 auto generated files
+Generated\ Files/
+
+# MSTest test Results
+[Tt]est[Rr]esult*/
+[Bb]uild[Ll]og.*
+
+# NUnit
+*.VisualState.xml
+TestResult.xml
+nunit-*.xml
+
+# Build Results of an ATL Project
+[Dd]ebugPS/
+[Rr]eleasePS/
+dlldata.c
+
+# Benchmark Results
+BenchmarkDotNet.Artifacts/
+
+# .NET Core
+project.lock.json
+project.fragment.lock.json
+artifacts/
+
+# ASP.NET Scaffolding
+ScaffoldingReadMe.txt
+
+# StyleCop
+StyleCopReport.xml
+
+# Files built by Visual Studio
+*_i.c
+*_p.c
+*_h.h
+*.ilk
+*.meta
+*.obj
+*.iobj
+*.pch
+*.pdb
+*.ipdb
+*.pgc
+*.pgd
+*.rsp
+*.sbr
+*.tlb
+*.tli
+*.tlh
+*.tmp
+*.tmp_proj
+*_wpftmp.csproj
+*.log
+*.vspscc
+*.vssscc
+.builds
+*.pidb
+*.svclog
+*.scc
+
+# Chutzpah Test files
+_Chutzpah*
+
+# Visual C++ cache files
+ipch/
+*.aps
+*.ncb
+*.opendb
+*.opensdf
+*.sdf
+*.cachefile
+*.VC.db
+*.VC.VC.opendb
+
+# Visual Studio profiler
+*.psess
+*.vsp
+*.vspx
+*.sap
+
+# Visual Studio Trace Files
+*.e2e
+
+# TFS 2012 Local Workspace
+$tf/
+
+# Guidance Automation Toolkit
+*.gpState
+
+# ReSharper is a .NET coding add-in
+_ReSharper*/
+*.[Rr]e[Ss]harper
+*.DotSettings.user
+
+# TeamCity is a build add-in
+_TeamCity*
+
+# DotCover is a Code Coverage Tool
+*.dotCover
+
+# AxoCover is a Code Coverage Tool
+.axoCover/*
+!.axoCover/settings.json
+
+# Coverlet is a free, cross platform Code Coverage Tool
+coverage*.json
+coverage*.xml
+coverage*.info
+
+# Visual Studio code coverage results
+*.coverage
+*.coveragexml
+
+# NCrunch
+_NCrunch_*
+.*crunch*.local.xml
+nCrunchTemp_*
+
+# MightyMoose
+*.mm.*
+AutoTest.Net/
+
+# Web workbench (sass)
+.sass-cache/
+
+# Installshield output folder
+[Ee]xpress/
+
+# DocProject is a documentation generator add-in
+DocProject/buildhelp/
+DocProject/Help/*.HxT
+DocProject/Help/*.HxC
+DocProject/Help/*.hhc
+DocProject/Help/*.hhk
+DocProject/Help/*.hhp
+DocProject/Help/Html2
+DocProject/Help/html
+
+# Click-Once directory
+publish/
+
+# Publish Web Output
+*.[Pp]ublish.xml
+*.azurePubxml
+# Note: Comment the next line if you want to checkin your web deploy settings,
+# but database connection strings (with potential passwords) will be unencrypted
+*.pubxml
+*.publishproj
+
+# Microsoft Azure Web App publish settings. Comment the next line if you want to
+# checkin your Azure Web App publish settings, but sensitive information contained
+# in these scripts will be unencrypted
+PublishScripts/
+
+# NuGet Packages
+*.nupkg
+# NuGet Symbol Packages
+*.snupkg
+# The packages folder can be ignored because of Package Restore
+**/[Pp]ackages/*
+# except build/, which is used as an MSBuild target.
+!**/[Pp]ackages/build/
+# Uncomment if necessary however generally it will be regenerated when needed
+#!**/[Pp]ackages/repositories.config
+# NuGet v3's project.json files produces more ignorable files
+*.nuget.props
+*.nuget.targets
+
+# Microsoft Azure Build Output
+csx/
+*.build.csdef
+
+# Microsoft Azure Emulator
+ecf/
+rcf/
+
+# Windows Store app package directories and files
+AppPackages/
+BundleArtifacts/
+Package.StoreAssociation.xml
+_pkginfo.txt
+*.appx
+*.appxbundle
+*.appxupload
+
+# Visual Studio cache files
+# files ending in .cache can be ignored
+*.[Cc]ache
+# but keep track of directories ending in .cache
+!?*.[Cc]ache/
+
+# Others
+ClientBin/
+~$*
+*~
+*.dbmdl
+*.dbproj.schemaview
+*.jfm
+*.pfx
+*.publishsettings
+orleans.codegen.cs
+
+# Including strong name files can present a security risk
+# (https://github.com/github/gitignore/pull/2483#issue-259490424)
+#*.snk
+
+# Since there are multiple workflows, uncomment next line to ignore bower_components
+# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
+#bower_components/
+
+# RIA/Silverlight projects
+Generated_Code/
+
+# Backup & report files from converting an old project file
+# to a newer Visual Studio version. Backup files are not needed,
+# because we have git ;-)
+_UpgradeReport_Files/
+Backup*/
+UpgradeLog*.XML
+UpgradeLog*.htm
+ServiceFabricBackup/
+*.rptproj.bak
+
+# SQL Server files
+*.mdf
+*.ldf
+*.ndf
+
+# Business Intelligence projects
+*.rdl.data
+*.bim.layout
+*.bim_*.settings
+*.rptproj.rsuser
+*- [Bb]ackup.rdl
+*- [Bb]ackup ([0-9]).rdl
+*- [Bb]ackup ([0-9][0-9]).rdl
+
+# Microsoft Fakes
+FakesAssemblies/
+
+# GhostDoc plugin setting file
+*.GhostDoc.xml
+
+# Node.js Tools for Visual Studio
+.ntvs_analysis.dat
+node_modules/
+
+# Visual Studio 6 build log
+*.plg
+
+# Visual Studio 6 workspace options file
+*.opt
+
+# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
+*.vbw
+
+# Visual Studio LightSwitch build output
+**/*.HTMLClient/GeneratedArtifacts
+**/*.DesktopClient/GeneratedArtifacts
+**/*.DesktopClient/ModelManifest.xml
+**/*.Server/GeneratedArtifacts
+**/*.Server/ModelManifest.xml
+_Pvt_Extensions
+
+# Paket dependency manager
+.paket/paket.exe
+paket-files/
+
+# FAKE - F# Make
+.fake/
+
+# CodeRush personal settings
+.cr/personal
+
+# Python Tools for Visual Studio (PTVS)
+__pycache__/
+*.pyc
+
+# Cake - Uncomment if you are using it
+# tools/**
+# !tools/packages.config
+
+# Tabs Studio
+*.tss
+
+# Telerik's JustMock configuration file
+*.jmconfig
+
+# BizTalk build output
+*.btp.cs
+*.btm.cs
+*.odx.cs
+*.xsd.cs
+
+# OpenCover UI analysis results
+OpenCover/
+
+# Azure Stream Analytics local run output
+ASALocalRun/
+
+# MSBuild Binary and Structured Log
+*.binlog
+
+# NVidia Nsight GPU debugger configuration file
+*.nvuser
+
+# MFractors (Xamarin productivity tool) working folder
+.mfractor/
+
+# Local History for Visual Studio
+.localhistory/
+
+# BeatPulse healthcheck temp database
+healthchecksdb
+
+# Backup folder for Package Reference Convert tool in Visual Studio 2017
+MigrationBackup/
+
+# Ionide (cross platform F# VS Code tools) working folder
+.ionide/
+
+# Fody - auto-generated XML schema
+FodyWeavers.xsd
\ No newline at end of file
diff --git a/App.xaml b/App.xaml
new file mode 100644
index 0000000..31dc28d
--- /dev/null
+++ b/App.xaml
@@ -0,0 +1,9 @@
+
+
+
+
+
diff --git a/App.xaml.cs b/App.xaml.cs
new file mode 100644
index 0000000..b29aa81
--- /dev/null
+++ b/App.xaml.cs
@@ -0,0 +1,14 @@
+using System.Configuration;
+using System.Data;
+using System.Windows;
+
+namespace Lab
+{
+ ///
+ /// Interaction logic for App.xaml
+ ///
+ public partial class App : Application
+ {
+ }
+
+}
diff --git a/ArrayReverseWindow.xaml b/ArrayReverseWindow.xaml
new file mode 100644
index 0000000..f27ea5d
--- /dev/null
+++ b/ArrayReverseWindow.xaml
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Введите элементы массива (числа) одной строкой. Разделители: пробел, запятая, ;.
+ Программа развернёт массив «на месте» (через обмен элементов).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ArrayReverseWindow.xaml.cs b/ArrayReverseWindow.xaml.cs
new file mode 100644
index 0000000..31927e0
--- /dev/null
+++ b/ArrayReverseWindow.xaml.cs
@@ -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
+{
+ ///
+ /// Interaction logic for ArrayReverseWindow.xaml
+ ///
+ 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
+
+
+
+
+
+
+
+
+
+
+
+ Объект описывает число first + second, где first — целая часть (int), а second — дробная часть (double) в диапазоне [0;1).
+ Метод multiply(double) возвращает новый объект, умноженный на заданное число.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/ClassMultiplyWindow.xaml.cs b/ClassMultiplyWindow.xaml.cs
new file mode 100644
index 0000000..3001480
--- /dev/null
+++ b/ClassMultiplyWindow.xaml.cs
@@ -0,0 +1,72 @@
+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
+{
+ ///
+ /// Interaction logic for ClassMultiplyWindow.xaml
+ ///
+ public partial class ClassMultiplyWindow : Window
+ {
+ private void ClickBack(object sender, RoutedEventArgs e) => Close();
+
+ private void ClickMul(object sender, RoutedEventArgs e)
+ {
+ ClassOutText.Text = "";
+
+ if (!Parsers.TryParseDouble(FirstBox.Text, out var first))
+ {
+ ClassOutText.Text = "first должен быть числом.";
+ return;
+ }
+
+ if (!Parsers.TryParseDouble(SecondBox.Text, out var second))
+ {
+ ClassOutText.Text = "second должен быть числом.";
+ return;
+ }
+
+ if (second < 0 || second >= 1)
+ {
+ ClassOutText.Text = "second должен быть в диапазоне [0; 1).";
+ return;
+ }
+
+ if (!Parsers.TryParseDouble(KBox.Text, out var k))
+ {
+ ClassOutText.Text = "k должен быть числом.";
+ return;
+ }
+
+ var num = new SplitNumber();
+ num.Value = first + second;
+
+ double val = num.Value;
+ first = num.first;
+ second = num.second;
+
+ num.Multiply(k);
+
+ ClassOutText.Text =
+ $"Исходное число: {val} (first={first}, second={second})\n" +
+ $"Множитель k = {k}\n" +
+ $"Результат: {num.Value} (first={num.first}, second={num.second})";
+ }
+
+ public ClassMultiplyWindow()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/FibonacciWindow.xaml b/FibonacciWindow.xaml
new file mode 100644
index 0000000..b1393e4
--- /dev/null
+++ b/FibonacciWindow.xaml
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Введите целое N (N > 0). Программа выведет все числа Фибоначчи, строго меньшие N.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/FibonacciWindow.xaml.cs b/FibonacciWindow.xaml.cs
new file mode 100644
index 0000000..a33fbc9
--- /dev/null
+++ b/FibonacciWindow.xaml.cs
@@ -0,0 +1,49 @@
+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
+{
+ ///
+ /// Interaction logic for FibonacciWindow.xaml
+ ///
+
+ public partial class FibonacciWindow : Window
+ {
+ private void ClickBack(object sender, RoutedEventArgs e) => Close();
+
+ private void ClickCalc(object sender, RoutedEventArgs e)
+ {
+ OutBox.Text = "";
+ InfoText.Text = "";
+
+ if (!Parsers.TryParseInt(NBox.Text, out int n) || n <= 0) {
+ InfoText.Text = "Введите целое N, N > 0.";
+ return;
+ }
+
+ long a = 1;
+ long b = 1;
+ List list = new List();
+ while (a < n) { list.Add(a); long next = a + b; a = b; b = next; }
+
+ OutBox.Text = string.Join(", ", list);
+ InfoText.Text = $"Найдено чисел: {list.Count}.";
+ }
+
+ public FibonacciWindow()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/Lab.csproj b/Lab.csproj
new file mode 100644
index 0000000..defb4d1
--- /dev/null
+++ b/Lab.csproj
@@ -0,0 +1,11 @@
+
+
+
+ WinExe
+ net9.0-windows
+ enable
+ enable
+ true
+
+
+
diff --git a/Lab.sln b/Lab.sln
new file mode 100644
index 0000000..386f671
--- /dev/null
+++ b/Lab.sln
@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio Version 17
+VisualStudioVersion = 17.14.36429.23 d17.14
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Lab", "Lab.csproj", "{35D80504-6D3F-4843-90A9-9318DC835884}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {35D80504-6D3F-4843-90A9-9318DC835884}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {35D80504-6D3F-4843-90A9-9318DC835884}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {35D80504-6D3F-4843-90A9-9318DC835884}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {35D80504-6D3F-4843-90A9-9318DC835884}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {83E5F320-DB1F-40AC-A37B-B87C8CB95B48}
+ EndGlobalSection
+EndGlobal
diff --git a/MainWindow.xaml b/MainWindow.xaml
new file mode 100644
index 0000000..cad60a5
--- /dev/null
+++ b/MainWindow.xaml
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+
+
+
+ Лабораторная работа №6
+
+
+ Пресняков Илья Сергеевич
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs
new file mode 100644
index 0000000..944ed9a
--- /dev/null
+++ b/MainWindow.xaml.cs
@@ -0,0 +1,39 @@
+using System.Text;
+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.Navigation;
+using System.Windows.Shapes;
+
+namespace Lab
+{
+ ///
+ /// Interaction logic for MainWindow.xaml
+ ///
+ public partial class MainWindow : Window
+ {
+ private void ClickOpenTriangleWindow (object sender, RoutedEventArgs e) => Open( new TriangleWindow() );
+ private void ClickOpenFibonacciWindow (object sender, RoutedEventArgs e) => Open( new FibonacciWindow() );
+ private void ClickOpenArrayReverseWindow (object sender, RoutedEventArgs e) => Open( new ArrayReverseWindow() );
+ private void ClickOpenMatrixCompareWindow (object sender, RoutedEventArgs e) => Open( new MatrixCompareWindow() );
+ private void ClickOpenMatrixFlipWindow (object sender, RoutedEventArgs e) => Open( new MatrixFlipWindow() );
+ private void ClickOpenClassMultiplyWindow (object sender, RoutedEventArgs e) => Open( new ClassMultiplyWindow() );
+
+ public MainWindow()
+ {
+ InitializeComponent();
+ }
+
+ private void Open(Window w)
+ {
+ w.Owner = this;
+ w.Closed += (_, _) => Show();
+ Hide();
+ w.Show();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Matrices.cs b/Matrices.cs
new file mode 100644
index 0000000..56566cc
--- /dev/null
+++ b/Matrices.cs
@@ -0,0 +1,106 @@
+using System;
+using System.Collections.Generic;
+using System.Data;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Lab
+{
+ internal class Matrices
+ {
+ public static DataTable CreateMatrix(int rows, int cols, string prefix)
+ {
+ DataTable dt = new DataTable();
+
+ for (int col = 0; col < cols; col++)
+ {
+ dt.Columns.Add($"{prefix}{col + 1}", typeof(double));
+ }
+
+ for (int row = 0; row < rows; row++)
+ {
+ DataRow dr = dt.NewRow();
+
+ for (int col = 0; col < cols; col++)
+ {
+ dr[col] = 0;
+ }
+
+ dt.Rows.Add(dr);
+ }
+
+ return dt;
+ }
+
+ public static DataTable CreateMatrixInts(int rows, int cols, string prefix)
+ {
+ DataTable dt = new DataTable();
+
+ for (int col = 0; col < cols; col++)
+ {
+ dt.Columns.Add($"{prefix}{col + 1}", typeof(int));
+ }
+
+ for (int row = 0; row < rows; row++)
+ {
+ DataRow dr = dt.NewRow();
+
+ for (int col = 0; col < cols; col++)
+ {
+ dr[col] = 0;
+ }
+
+ dt.Rows.Add(dr);
+ }
+
+ return dt;
+ }
+
+ public static void RandomFill(DataTable dt, int minIncl, int maxIncl)
+ {
+ Random rng = new Random();
+ for (int row = 0; row < dt.Rows.Count; row++)
+ {
+ for (int col = 0; col < dt.Columns.Count; col++)
+ {
+ dt.Rows[row][col] = (double)rng.Next(minIncl, maxIncl + 1);
+ }
+ }
+ }
+
+ public static int[,] ToArray(DataTable dt)
+ {
+ int rows = dt.Rows.Count;
+ int cols = dt.Columns.Count;
+ var array = new int[rows, cols];
+
+ for (int row =0; row < rows; row++)
+ {
+ for (int col = 0; col < cols; col++)
+ {
+ array[row, col] = Convert.ToInt32(dt.Rows[row][col]);
+ }
+ }
+
+ return array;
+ }
+
+ public static DataTable FromArray(int[,] array, string prefix)
+ {
+ int rows = array.GetLength(0);
+ int cols = array.GetLength(1);
+ var dt = CreateMatrix(rows, cols, prefix);
+
+ for (int row = 0; row < rows; row++)
+ {
+ for (int col = 0; col < cols; col++)
+ {
+ dt.Rows[row][col] = array[row, col];
+ }
+ }
+
+ return dt;
+ }
+ }
+}
diff --git a/MatrixCompareWindow.xaml b/MatrixCompareWindow.xaml
new file mode 100644
index 0000000..9b2018b
--- /dev/null
+++ b/MatrixCompareWindow.xaml
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Дана матрица A размера 11x11. Построить матрицу B того же размера, где
+ B[i,j]=1, если A[i,j] строго больше диагонального элемента A[i,i] в своей строке, иначе 0.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/MatrixCompareWindow.xaml.cs b/MatrixCompareWindow.xaml.cs
new file mode 100644
index 0000000..6c2055e
--- /dev/null
+++ b/MatrixCompareWindow.xaml.cs
@@ -0,0 +1,62 @@
+using System;
+using System.Collections.Generic;
+using System.Data;
+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
+{
+ ///
+ /// Interaction logic for MatrixCompareWindow.xaml
+ ///
+ public partial class MatrixCompareWindow : Window
+ {
+ private DataTable _a = Matrices.CreateMatrix(11, 11, "A");
+ private DataTable _b = Matrices.CreateMatrixInts(11, 11, "B");
+
+ private void ClickBack(object sender, RoutedEventArgs e) => Close();
+
+ private void ClickGen(object sender, RoutedEventArgs e)
+ {
+ Matrices.RandomFill(_a, -25, 25);
+ MatrixInfoText.Text = "Матрица A сгенерирована.";
+ }
+
+ private void ClickBuild(object sender, RoutedEventArgs e)
+ {
+ var a = Matrices.ToArray(_a);
+ var b = new int[11, 11];
+
+ for (int row = 0; row < 11; row++)
+ {
+ int diag = a[row, row];
+
+ for (int col = 0; col < 11; col++)
+ {
+ b[row, col] = a[row, col] > diag ? 1 : 0;
+ }
+ }
+
+ _b = Matrices.FromArray(b, "B");
+ GridB.ItemsSource = _b.DefaultView;
+
+ MatrixInfoText.Text = "Матрица B построена.";
+ }
+
+ public MatrixCompareWindow()
+ {
+ InitializeComponent();
+ GridA.ItemsSource = _a.DefaultView;
+ GridB.ItemsSource = _b.DefaultView;
+ }
+ }
+}
diff --git a/MatrixFlipWindow.xaml b/MatrixFlipWindow.xaml
new file mode 100644
index 0000000..c45f07f
--- /dev/null
+++ b/MatrixFlipWindow.xaml
@@ -0,0 +1,43 @@
+
+
+
+
+
+ Создайте неквадратную матрицу размером R×C (динамически), заполненную целыми числами 0..100.
+ Затем отразите её относительно центральной горизонтальной оси (переверните строки: первая - последняя, и т.д.).
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/MatrixFlipWindow.xaml.cs b/MatrixFlipWindow.xaml.cs
new file mode 100644
index 0000000..f4e7255
--- /dev/null
+++ b/MatrixFlipWindow.xaml.cs
@@ -0,0 +1,94 @@
+using System;
+using System.Collections.Generic;
+using System.Data;
+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
+{
+ ///
+ /// Interaction logic for MatrixFlipWindow.xaml
+ ///
+ public partial class MatrixFlipWindow : Window
+ {
+ private DataTable? _src;
+ private DataTable? _dst;
+
+ private void ClickBack(object sender, RoutedEventArgs e) => Close();
+
+ private bool TryGetSize(out int rows, out int cols)
+ {
+ rows = 0;
+ cols = 0;
+
+ if (!Parsers.TryParseInt(RowsBox.Text, out rows) || !Parsers.TryParseInt(ColsBox.Text, out cols)) {
+ FlipInfoText.Text = "Размеры должны быть целыми числами.";
+ return false;
+ }
+
+ if (rows < 1 || cols < 1)
+ {
+ FlipInfoText.Text = "Размеры должны быть больше 1";
+ return false;
+ }
+
+ return true;
+ }
+
+ private void ClickCreate(object sender, RoutedEventArgs e)
+ {
+ if (!TryGetSize(out int rows, out int cols)) return;
+
+ _src = Matrices.CreateMatrixInts(rows, cols, "A");
+ Matrices.RandomFill(_src, 0, 100);
+ GridSrc.ItemsSource = _src.DefaultView;
+
+ _dst = Matrices.CreateMatrixInts(rows, cols, "B");
+ GridDst.ItemsSource = _dst.DefaultView;
+
+ FlipInfoText.Text = $"Создана матрица {rows}×{cols}, заполнена числами 0..100.";
+ }
+
+ private void ClickFlip(object sender, RoutedEventArgs e)
+ {
+ if (_src is null)
+ {
+ FlipInfoText.Text = "Сначала создайте матрицу.";
+ return;
+ }
+
+ var a = Matrices.ToArray(_src);
+ int rows = a.GetLength(0);
+ int cols = a.GetLength(1);
+
+ var b = new int[rows, cols];
+
+ for (int row = 0; row < rows; row++)
+ {
+ for (int col = 0; col < cols; col++)
+ {
+ b[rows - 1 - row, col] = a[row, col];
+ }
+ }
+
+ _dst = Matrices.FromArray(b, "B");
+ GridDst.ItemsSource = _dst.DefaultView;
+
+ FlipInfoText.Text = "Готово: строки перевёрнуты (отражение по горизонтальной оси).";
+ }
+
+ public MatrixFlipWindow()
+ {
+ InitializeComponent();
+ }
+ }
+}
diff --git a/Parsers.cs b/Parsers.cs
new file mode 100644
index 0000000..19b817f
--- /dev/null
+++ b/Parsers.cs
@@ -0,0 +1,44 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Lab
+{
+ internal class Parsers
+ {
+ public static bool TryParseDouble(string? s, out double val) => double.TryParse((s ?? "").Trim().Replace(",", "."), out val);
+ public static bool TryParseInt(string? s, out int val) => int.TryParse((s ?? "").Trim(), out val);
+
+ public static bool TryParseDoubleArray(string? s, out double[] vals, out string err)
+ {
+ vals = Array.Empty();
+ err = "";
+
+ if (string.IsNullOrEmpty(s) || string.IsNullOrEmpty(s)) {
+ err = "Пустой ввод. Введите числа, разделяя их пробелами/запятыми/точкой с запятой.";
+ return false;
+ }
+
+ string[] parts = s.Split(new[] { ' ', '\t', '\n', '\r', ',', ';' });
+
+ List list = new List();
+
+ for (int i = 0; i < parts.Length; i++)
+ {
+ if (!TryParseDouble(parts[i], out double val))
+ {
+ err = $"Вронгаешь элемент! [ #{i + 1}: «{parts[i]}» ]";
+ return false;
+ }
+
+ list.Add(val);
+ }
+
+ vals = list.ToArray();
+
+ return true;
+ }
+ }
+}
diff --git a/SplitNumber.cs b/SplitNumber.cs
new file mode 100644
index 0000000..8e33e21
--- /dev/null
+++ b/SplitNumber.cs
@@ -0,0 +1,37 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Lab
+{
+ internal class SplitNumber
+ {
+ public double first { get; private set; }
+ public double second { get; private set; }
+
+ public double Value
+ {
+ get { return first + second; }
+ set
+ {
+ first = Math.Truncate(value);
+ second = Math.Abs(value - first);
+
+ second = Math.Round(second, 10);
+
+ if (second >= 1)
+ {
+ first += 1;
+ second = 0;
+ }
+ }
+ }
+
+ public void Multiply(double m)
+ {
+ Value = Value * m;
+ }
+ }
+}
diff --git a/TriangleWindow.xaml b/TriangleWindow.xaml
new file mode 100644
index 0000000..fdf0cf9
--- /dev/null
+++ b/TriangleWindow.xaml
@@ -0,0 +1,49 @@
+
+
+
+
+
+
+
+
+
+
+
+ Даны положительные действительные x, y, z. Проверить, существует ли треугольник со сторонами x, y, z.
+ Условие: сумма любых двух сторон строго больше третьей.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/TriangleWindow.xaml.cs b/TriangleWindow.xaml.cs
new file mode 100644
index 0000000..870ae2a
--- /dev/null
+++ b/TriangleWindow.xaml.cs
@@ -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
+{
+ ///
+ /// Interaction logic for TriangleWindow.xaml
+ ///
+
+
+ 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();
+ }
+ }
+}