Procházet zdrojové kódy

Загрузить файлы ''

21IS15 před 2 roky
rodič
revize
d8c13bdd02
1 změnil soubory, kde provedl 53 přidání a 0 odebrání
  1. 53 0
      Form1_Lab3.cs

+ 53 - 0
Form1_Lab3.cs

@@ -0,0 +1,53 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+using static System.Windows.Forms.VisualStyles.VisualStyleElement;
+
+namespace Ul_3
+{
+    public partial class Form1 : Form
+    {
+        public Form1()
+        {
+            InitializeComponent();
+        }
+
+        private void button1_Click(object sender, EventArgs e)
+        {
+            double x = double.Parse(textBox1.Text);
+            double y = double.Parse(textBox2.Text);
+
+            // решаем уравнение
+            double result = SolveEquation(x, y);
+
+            // выводим результат
+            textBox3.Text = result.ToString();
+        }
+
+        private double SolveEquation(double x, double y)
+        {
+            double result = 0;
+
+            if (Math.Abs(x - y) < 0.0001)
+            {
+                result = Math.Pow(Math.Sin(x), 2) + Math.Sin(y);
+            }
+            else if (x - y > 0)
+            {
+                result = Math.Cos(x) + Math.Cos(y);
+            }
+            else if (x - y < 0)
+            {
+                result = y - Math.Pow(Math.Tan(x), 2) + Math.Tan(y);
+            }
+
+            return result;
+        }
+    }
+}