Как подключить dll, в которой реализуется вычисления тригонометрических функций - C#
Формулировка задачи:
Проект на C# (CLR) в Visual Studio 10...
Проблемка в том, что я не знаю как подключить dll, в которой реализуется вычисления тригонометрических функций... Помогите пожалуйста.
Листинг программы
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- namespace MathFunctionF
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void button3_Click(object sender, EventArgs e)
- {
- }
- private void button1_Click(object sender, EventArgs e)
- {
- progressBar1.Value = 0;
- timer1.Enabled = true;
- double a, b, res;
- a = Convert.ToDouble(textBox1.Text);
- b = Convert.ToDouble(textBox2.Text);
- if (comboBox1.SelectedIndex == 0)
- {
- res = a + b;
- textBox3.Text = Convert.ToString(res);
- }
- if (comboBox1.SelectedIndex == 1)
- {
- res = a - b;
- textBox3.Text = Convert.ToString(res);
- }
- if (comboBox1.SelectedIndex == 2)
- {
- res = a * b;
- textBox3.Text = Convert.ToString(res);
- }
- if (comboBox1.SelectedIndex == 3)
- {
- if (b == 0)
- MessageBox.Show("Ошибка деления на ноль!");
- else
- {
- res = a / b;
- textBox3.Text = Convert.ToString(res);
- }
- }
- if (comboBox1.SelectedIndex == 4)
- {
- if (b == 0)
- MessageBox.Show("Ошибка деления на ноль!");
- else
- {
- res = a % b;
- textBox3.Text = Convert.ToString(res);
- }
- }
- }
- private void button2_Click(object sender, EventArgs e)
- {
- progressBar2.Value = 0;
- timer2.Enabled = true;
- double a, b, res;
- a = Convert.ToDouble(textBox6.Text);
- a = a * Math.PI / 180;
- if (comboBox2.SelectedIndex == 0)
- {
- res = Math.Abs(a);
- textBox4.Text = Convert.ToString(res);
- }
- if (comboBox2.SelectedIndex == 1)
- {
- res = Math.Acos(a);
- res = Math.Round(res, 5);
- textBox4.Text = Convert.ToString(res);
- }
- if (comboBox2.SelectedIndex == 2)
- {
- res = Math.Asin(a);
- res = Math.Round(res, 5);
- textBox4.Text = Convert.ToString(res);
- }
- if (comboBox2.SelectedIndex == 3)
- {
- res = Math.Atan(a);
- res = Math.Round(res, 5);
- textBox4.Text = Convert.ToString(res);
- }
- if (comboBox2.SelectedIndex == 4)
- {
- b = Convert.ToDouble(textBox5.Text);
- res = Math.Atan2(a, b);
- textBox4.Text = Convert.ToString(res);
- }
- if (comboBox2.SelectedIndex == 5)
- {
- res = Math.Cos(a);
- res = Math.Round(res, 5);
- textBox4.Text = Convert.ToString(res);
- }
- if (comboBox2.SelectedIndex == 6)
- {
- res = Math.Sin(a);
- res = Math.Round(res, 5);
- textBox4.Text = Convert.ToString(res);
- }
- if (comboBox2.SelectedIndex == 7)
- {
- res = Math.Tan(a);
- res = Math.Round(res, 5);
- textBox4.Text = Convert.ToString(res);
- }
- if (comboBox2.SelectedIndex == 8)
- {
- res = Math.E;
- textBox4.Text = Convert.ToString(res);
- }
- if (comboBox2.SelectedIndex == 9)
- {
- res = Math.PI;
- textBox4.Text = Convert.ToString(res);
- }
- if (comboBox2.SelectedIndex == 10)
- {
- res = Math.Log10(a);
- textBox4.Text = Convert.ToString(res);
- }
- if (comboBox2.SelectedIndex == 11)
- {
- res = Math.Round(a);
- textBox4.Text = Convert.ToString(res);
- }
- if (comboBox2.SelectedIndex == 12)
- {
- res = Math.Sqrt(a);
- textBox4.Text = Convert.ToString(res);
- }
- if (comboBox2.SelectedIndex == 13)
- {
- res = Math.Truncate(a);
- textBox4.Text = Convert.ToString(res);
- }
- }
- private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
- {
- if (comboBox2.SelectedIndex == 4)
- textBox5.Enabled = true;
- else
- textBox5.Enabled = false;
- }
- private void label1_Click(object sender, EventArgs e)
- {
- }
- private void Form1_Load(object sender, EventArgs e)
- {
- }
- private void timer1_Tick(object sender, EventArgs e)
- {
- progressBar1.Minimum = 0;
- progressBar1.Maximum = 1;
- progressBar1.Step = 1;
- progressBar1.PerformStep();
- }
- private void progressBar2_Click(object sender, EventArgs e)
- {
- }
- private void progressBar1_Click(object sender, EventArgs e)
- {
- }
- private void timer2_Tick(object sender, EventArgs e)
- {
- progressBar2.Minimum = 0;
- progressBar2.Maximum = 1;
- progressBar2.Step = 1;
- progressBar2.PerformStep();
- }
- private void menuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
- {
- }
- private void openToolStripMenuItem_Click(object sender, EventArgs e)
- {
- }
- private void информацияToolStripMenuItem_Click(object sender, EventArgs e)
- {
- MessageBox.Show("Сообщение");
- }
- private void menuStrip2_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
- {
- }
- }
- }
Решение задачи: «Как подключить dll, в которой реализуется вычисления тригонометрических функций»
textual
Листинг программы
- switch (comboBox2.SelectedIndex)
- {
- case 0:
- res = Math.Abs(a);
- textBox4.Text = Convert.ToString(res);
- break;
- case 1:
- res = Math.Round(Math.Acos(a), 5);
- textBox4.Text = Convert.ToString(res);
- break;
- }
ИИ поможет Вам:
- решить любую задачу по программированию
- объяснить код
- расставить комментарии в коде
- и т.д