Как подключить dll, в которой реализуется вычисления тригонометрических функций - C#

Узнай цену своей работы

Формулировка задачи:

Проект на C# (CLR) в Visual Studio 10...
Листинг программы
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. namespace MathFunctionF
  10. {
  11. public partial class Form1 : Form
  12. {
  13. public Form1()
  14. {
  15. InitializeComponent();
  16. }
  17. private void button3_Click(object sender, EventArgs e)
  18. {
  19. }
  20. private void button1_Click(object sender, EventArgs e)
  21. {
  22. progressBar1.Value = 0;
  23. timer1.Enabled = true;
  24. double a, b, res;
  25. a = Convert.ToDouble(textBox1.Text);
  26. b = Convert.ToDouble(textBox2.Text);
  27. if (comboBox1.SelectedIndex == 0)
  28. {
  29. res = a + b;
  30. textBox3.Text = Convert.ToString(res);
  31. }
  32. if (comboBox1.SelectedIndex == 1)
  33. {
  34. res = a - b;
  35. textBox3.Text = Convert.ToString(res);
  36. }
  37. if (comboBox1.SelectedIndex == 2)
  38. {
  39. res = a * b;
  40. textBox3.Text = Convert.ToString(res);
  41. }
  42. if (comboBox1.SelectedIndex == 3)
  43. {
  44. if (b == 0)
  45. MessageBox.Show("Ошибка деления на ноль!");
  46. else
  47. {
  48. res = a / b;
  49. textBox3.Text = Convert.ToString(res);
  50. }
  51. }
  52. if (comboBox1.SelectedIndex == 4)
  53. {
  54. if (b == 0)
  55. MessageBox.Show("Ошибка деления на ноль!");
  56. else
  57. {
  58. res = a % b;
  59. textBox3.Text = Convert.ToString(res);
  60. }
  61. }
  62. }
  63. private void button2_Click(object sender, EventArgs e)
  64. {
  65. progressBar2.Value = 0;
  66. timer2.Enabled = true;
  67. double a, b, res;
  68. a = Convert.ToDouble(textBox6.Text);
  69. a = a * Math.PI / 180;
  70. if (comboBox2.SelectedIndex == 0)
  71. {
  72. res = Math.Abs(a);
  73. textBox4.Text = Convert.ToString(res);
  74. }
  75. if (comboBox2.SelectedIndex == 1)
  76. {
  77. res = Math.Acos(a);
  78. res = Math.Round(res, 5);
  79. textBox4.Text = Convert.ToString(res);
  80. }
  81. if (comboBox2.SelectedIndex == 2)
  82. {
  83. res = Math.Asin(a);
  84. res = Math.Round(res, 5);
  85. textBox4.Text = Convert.ToString(res);
  86. }
  87. if (comboBox2.SelectedIndex == 3)
  88. {
  89. res = Math.Atan(a);
  90. res = Math.Round(res, 5);
  91. textBox4.Text = Convert.ToString(res);
  92. }
  93. if (comboBox2.SelectedIndex == 4)
  94. {
  95. b = Convert.ToDouble(textBox5.Text);
  96. res = Math.Atan2(a, b);
  97. textBox4.Text = Convert.ToString(res);
  98. }
  99. if (comboBox2.SelectedIndex == 5)
  100. {
  101. res = Math.Cos(a);
  102. res = Math.Round(res, 5);
  103. textBox4.Text = Convert.ToString(res);
  104. }
  105. if (comboBox2.SelectedIndex == 6)
  106. {
  107. res = Math.Sin(a);
  108. res = Math.Round(res, 5);
  109. textBox4.Text = Convert.ToString(res);
  110. }
  111. if (comboBox2.SelectedIndex == 7)
  112. {
  113. res = Math.Tan(a);
  114. res = Math.Round(res, 5);
  115. textBox4.Text = Convert.ToString(res);
  116. }
  117. if (comboBox2.SelectedIndex == 8)
  118. {
  119. res = Math.E;
  120. textBox4.Text = Convert.ToString(res);
  121. }
  122. if (comboBox2.SelectedIndex == 9)
  123. {
  124. res = Math.PI;
  125. textBox4.Text = Convert.ToString(res);
  126. }
  127. if (comboBox2.SelectedIndex == 10)
  128. {
  129. res = Math.Log10(a);
  130. textBox4.Text = Convert.ToString(res);
  131. }
  132. if (comboBox2.SelectedIndex == 11)
  133. {
  134. res = Math.Round(a);
  135. textBox4.Text = Convert.ToString(res);
  136. }
  137. if (comboBox2.SelectedIndex == 12)
  138. {
  139. res = Math.Sqrt(a);
  140. textBox4.Text = Convert.ToString(res);
  141. }
  142. if (comboBox2.SelectedIndex == 13)
  143. {
  144. res = Math.Truncate(a);
  145. textBox4.Text = Convert.ToString(res);
  146. }
  147. }
  148. private void comboBox2_SelectedIndexChanged(object sender, EventArgs e)
  149. {
  150. if (comboBox2.SelectedIndex == 4)
  151. textBox5.Enabled = true;
  152. else
  153. textBox5.Enabled = false;
  154. }
  155. private void label1_Click(object sender, EventArgs e)
  156. {
  157.  
  158. }
  159. private void Form1_Load(object sender, EventArgs e)
  160. {
  161. }
  162. private void timer1_Tick(object sender, EventArgs e)
  163. {
  164. progressBar1.Minimum = 0;
  165. progressBar1.Maximum = 1;
  166. progressBar1.Step = 1;
  167. progressBar1.PerformStep();
  168. }
  169. private void progressBar2_Click(object sender, EventArgs e)
  170. {
  171. }
  172. private void progressBar1_Click(object sender, EventArgs e)
  173. {
  174. }
  175. private void timer2_Tick(object sender, EventArgs e)
  176. {
  177. progressBar2.Minimum = 0;
  178. progressBar2.Maximum = 1;
  179. progressBar2.Step = 1;
  180. progressBar2.PerformStep();
  181. }
  182. private void menuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
  183. {
  184. }
  185. private void openToolStripMenuItem_Click(object sender, EventArgs e)
  186. {
  187. }
  188. private void информацияToolStripMenuItem_Click(object sender, EventArgs e)
  189. {
  190. MessageBox.Show("Сообщение");
  191. }
  192. private void menuStrip2_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
  193. {
  194. }
  195. }
  196. }
Проблемка в том, что я не знаю как подключить dll, в которой реализуется вычисления тригонометрических функций... Помогите пожалуйста.

Решение задачи: «Как подключить dll, в которой реализуется вычисления тригонометрических функций»

textual
Листинг программы
  1. switch (comboBox2.SelectedIndex)
  2. {
  3.     case 0:
  4.         res = Math.Abs(a);
  5.         textBox4.Text = Convert.ToString(res);
  6.         break;
  7.  
  8.     case 1:
  9.       res = Math.Round(Math.Acos(a), 5);
  10.       textBox4.Text = Convert.ToString(res);
  11.       break;
  12. }

ИИ поможет Вам:


  • решить любую задачу по программированию
  • объяснить код
  • расставить комментарии в коде
  • и т.д
Попробуйте бесплатно

Оцени полезность:

11   голосов , оценка 4.091 из 5

Нужна аналогичная работа?

Оформи быстрый заказ и узнай стоимость

Бесплатно
Оформите заказ и авторы начнут откликаться уже через 10 минут
Похожие ответы