Advertisement
Guest User

Untitled

a guest
Feb 25th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.53 KB | None | 0 0
  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.Threading.Tasks;
  9. using System.Windows.Forms;
  10.  
  11. namespace WindowsFormsApplication1
  12. {
  13. public partial class Form1 : Form
  14. {
  15. public Form1()
  16. {
  17. InitializeComponent();
  18. }
  19.  
  20. private void button1_Click(object sender, EventArgs e)
  21. {
  22. double A, B, h, x = 0, y = 0, t = 0;
  23. A = Convert.ToDouble(textBox1.Text);
  24. B = Convert.ToDouble(textBox2.Text);
  25. h = Convert.ToDouble(textBox3.Text);
  26.  
  27. String str = comboBox1.SelectedItem.ToString();
  28. MessageBox.Show(str);
  29. if (str == "Коло")
  30. {
  31. for(t = A; t <= B + 0.1 * h; t += h)
  32. {
  33. x = Math.Sin(t);
  34. y = Math.Cos(t);
  35. chart1.Series[0].Points.AddXY(x, y);
  36. x = Math.Round(x, 2); y = Math.Round(y, 2);
  37. listBox1.Items.Add((x + "\t\t " + y));
  38. }
  39. }
  40. if (str == "Спіраль")
  41. {
  42. for (t = A; t <= B + 0.1 * h; t += h)
  43. {
  44. x = Math.Sin(t)*t;
  45. y = Math.Cos(t)*t;
  46. chart1.Series[0].Points.AddXY(x, y);
  47. x = Math.Round(x, 5); y = Math.Round(y, 5);
  48. listBox1.Items.Add((x + "\t\t " + y));
  49. }
  50. }
  51. if (str == "Дельтоїда")
  52. {
  53. for (t = A; t <= B + 0.1 * h; t += h)
  54. {
  55. x = Math.Cos(t)*2 + Math.Cos(t + t);
  56. y = Math.Sin(t)*2 - Math.Sin(t + t);
  57. chart1.Series[0].Points.AddXY(x, y);
  58. x = Math.Round(x, 2); y = Math.Round(y, 2);
  59. listBox1.Items.Add((x + "\t\t " + y));
  60. }
  61. }
  62. if (str == "Астроїда")
  63. {
  64. for (t = A; t <= B + 0.1 * h; t += h)
  65. {
  66. x = (Math.Sin(t) * Math.Sin(t) * Math.Sin(t))*2;
  67. y = (Math.Cos(t) * Math.Cos(t) * Math.Cos(t))*2;
  68. chart1.Series[0].Points.AddXY(x, y);
  69. x = Math.Round(x, 2); y = Math.Round(y, 2);
  70. listBox1.Items.Add((x + "\t\t " + y));
  71. }
  72. }
  73. }
  74. }
  75. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement