Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Лабораторная работа №4.docx
Скачиваний:
4
Добавлен:
04.03.2022
Размер:
563.32 Кб
Скачать

7 Код программы

ClassLibrary2.dll

using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

using System.Windows.Forms;

namespace ClassLibrary2

{

public class Class1

{

public static double Input (TextBox t)

{

return Convert.ToDouble(t.Text);

}

public static void Output(TextBox t, double c)

{

t.Text = Convert.ToString(c);

}

public static double Ugli(double x1, double x2, double y1, double y2)

{

double a = (x1 * x2 + y1 * y2) / (Math.Sqrt(Math.Pow(x1, 2) + Math.Pow(y1, 2)) * Math.Sqrt(Math.Pow(x2, 2) + Math.Pow(y2, 2)));

return Math.Cos(a);

}

public static void UgliRef(double x1, double x2, double y1, double y2, double x3, double y3, ref double ug1, ref double ug2, ref double ug3)

{

ug1 = Ugli(x1, y1, x2, y2);

ug2 = Ugli(x2, y2, x3, y3);

ug3 = Ugli(x1, y1, x3, y3);

}

public static void UgliOut(double x1, double x2, double y1, double y2, double x3, double y3, out double ug1, out double ug2, out double ug3)

{

ug1 = Ugli(x1, y1, x2, y2);

ug2 = Ugli(x2, y2, x3, y3);

ug3 = Ugli(x1, y1, x3, y3);

}

}

}

Form1.cs

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;

namespace Второй_курс

{

public partial class Form1 : Form

{

public Form1()

{

InitializeComponent();

}

private void label3_Click(object sender, EventArgs e)

{

}

private void label2_Click(object sender, EventArgs e)

{

}

private void label9_Click(object sender, EventArgs e)

{

}

private void label10_Click(object sender, EventArgs e)

{

}

private void button1_Click(object sender, EventArgs e)

{

Form2 f = new Form2();

this.Hide();

f.ShowDialog();

}

private void button2_Click(object sender, EventArgs e)

{

Form4 f = new Form4();

this.Hide();

f.ShowDialog();

}

private void button3_Click(object sender, EventArgs e)

{

Form6 f = new Form6();

this.Hide();

f.ShowDialog();

}

}

}

Form6.cs

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 System.Reflection;

using ClassLibrary1;

using ClassLibrary2;

namespace Второй_курс

{

public partial class Form6 : Form

{

public Form6()

{

InitializeComponent();

}

private void button1_Click(object sender, EventArgs e)

{

double S_a=0, S_b=0, S_c= 0;

double L_a=0,L_b=0,L_c= 0;

L_a = ClassLibrary1.vscode.Vvod(textBox1);

L_b = ClassLibrary1.vscode.Vvod(textBox2);

L_c = ClassLibrary1.vscode.Vvod(textBox3);

ClassLibrary1.vscode.TriPloshadi(L_a, L_b, L_c, ref S_a, ref S_b, ref S_c);

ClassLibrary1.vscode.Vivod(textBox4, S_a);

ClassLibrary1.vscode.Vivod(textBox5, S_b);

ClassLibrary1.vscode.Vivod(textBox6, S_c);

}

private void button3_Click(object sender, EventArgs e)

{

double L_a, L_b, L_c, S_a, S_b, S_c;

L_a = ClassLibrary1.vscode.Vvod(textBox1);

L_b = ClassLibrary1.vscode.Vvod(textBox2);

L_c = ClassLibrary1.vscode.Vvod(textBox3);

ClassLibrary1.vscode.TriPloshadi2(L_a, L_b, L_c, out S_a, out S_b, out S_c);

ClassLibrary1.vscode.Vivod(textBox4, S_a);

ClassLibrary1.vscode.Vivod(textBox5, S_b);

ClassLibrary1.vscode.Vivod(textBox6, S_c);

}

private void button2_Click(object sender, EventArgs e)

{

Form1 f = new Form1();

this.Hide();

f.ShowDialog();

}

private void button4_Click(object sender, EventArgs e)

{

double ug1 = 0, ug2 = 0, ug3 = 0;

double x1, x2, x3, y1, y2, y3;

x1 = ClassLibrary2.Class1.Input(textBox7);

y1 = ClassLibrary2.Class1.Input(textBox8);

x2 = ClassLibrary2.Class1.Input(textBox9);

y2 = ClassLibrary2.Class1.Input(textBox10);

x3 = ClassLibrary2.Class1.Input(textBox11);

y3 = ClassLibrary2.Class1.Input(textBox12);

ClassLibrary2.Class1.UgliRef(x1, y1, x2, y2, x3, y3, ref ug1, ref ug2, ref ug3);

ClassLibrary2.Class1.Output(textBox7, ug1 * (180 / Math.PI));

ClassLibrary2.Class1.Output(textBox8, ug2 * (180 / Math.PI));

ClassLibrary2.Class1.Output(textBox9, ug3 * (180 / Math.PI));

}

private void button5_Click(object sender, EventArgs e)

{

double ug1, ug2, ug3, x1, x2, x3, y1, y2, y3;

x1 = ClassLibrary2.Class1.Input(textBox7);

y1 = ClassLibrary2.Class1.Input(textBox8);

x2 = ClassLibrary2.Class1.Input(textBox9);

y2 = ClassLibrary2.Class1.Input(textBox10);

x3 = ClassLibrary2.Class1.Input(textBox11);

y3 = ClassLibrary2.Class1.Input(textBox12);

ClassLibrary2.Class1.UgliOut(x1, x2, y1, y2, x3, y3, out ug1, out ug2, out ug3);

ClassLibrary2.Class1.Output(textBox13, ug1);

ClassLibrary2.Class1.Output(textBox14, ug2);

ClassLibrary2.Class1.Output(textBox15, ug3);

}

}

}