Instantly share code, notes, and snippets.

# /aa Created Sep 13, 2017

Question:a
 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 WindowsFormsApp1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { // //Array[i,j,k] double a, b, c1; // a = b = c1 = 0; a = Convert.ToDouble(textBox1.Text); b = Convert.ToDouble(textBox2.Text); c1 = Convert.ToDouble(textBox3.Text); chart1.Series[0].Points.Clear(); // 清除原始 Diagram before 進入 Loop for (double z = -100; z <= 100; z = z + 0.1) // z = x for Q1 { double t; t = 0; if (z <= a) { t = 0; } else if (a <= z && z <= b) { t = (z - a) / (b - a); } else if (b <= z && z <= c1) { t = (c1 - z) / (c1 - b); } else if (z >= c1) { t = 0; } else { } chart1.Series[0].Points.AddXY(z,t); } // for (double i = -10; i <= 10; i = i + 0.1) // { // //double j, k, l; // //j = 0; // //k = 0; // //l = 0; // switch (i,j,k) // { // case 1: // Console.WriteLine(); // break; // case 2: // Console.WriteLine(); // break; // default: // break; // } // } //} // for (double z2 = -10; z2 <= 10; z2 = z2 + 0.1) //修改變數名稱 { double a3, c3, b3, Ans; a3 = b3 = c3 = 0; Ans = 1 / (1 + Math.Pow((Math.Abs((z2 - c3) / a3)), 2 * b3)); } } private void textBox3_TextChanged(object sender, EventArgs e) { } } }