| 网站首页 | 业界新闻 | 群组 | 交易 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
 跟大牛学C++学算法数据结构

已结贴   问题点数：20  回复次数：5

namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{
class hanshu
{
public double F(int x)
{
const double a1=30.58;
const double b1=-110.7;
const double c1=27.96;
double f=a1*Math.Exp(-((x-b1)/c1)*((x-b1)/c1));
}
}

}

private void textBox1_TextChanged(object sender, EventArgs e)
{

}

private void textBox2_TextChanged(object sender, EventArgs e)
{

}

private void textBox3_TextChanged(object sender, EventArgs e)
{

}

private void button1_Click(object sender, EventArgs e)
{
hanshu qiangdu1=new hanshu();
int x=Convert.ToInt32(textBox1.Text);
double r1=qiangdu1.F(x);

hanshu qiangdu2=new hanshu();
int m=Convert.ToInt32(textBox2.Text);
double r2=qiangdu1.F(m);

hanshu qiangdu3=new hanshu();
int n=Convert.ToInt32(textBox3.Text);
double r3=qiangdu1.F(n);

Graphics gra = this.pictureBox1.CreateGraphics();
Pen pen = new Pen(Color.Pink);
gra.DrawEllipse(pen, 10, 10, Convert.ToInt32(r1), Convert.ToInt32(r1));
gra.DrawEllipse(pen, 20, 10,Convert.ToInt32(r2), Convert.ToInt32(r2));
gra.DrawEllipse(pen, 10, 20,Convert.ToInt32(r3), Convert.ToInt32(r3));

}
}
}

得分:20
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{

public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{

}

private void textBox1_TextChanged(object sender, EventArgs e)
{

}

private void textBox2_TextChanged(object sender, EventArgs e)
{

}

private void textBox3_TextChanged(object sender, EventArgs e)
{

}

private void button1_Click(object sender, EventArgs e)
{
hanshu qiangdu1 = new hanshu();
int x = Convert.ToInt32(textBox1.Text);
double r1 = qiangdu1.F(x);

hanshu qiangdu2 = new hanshu();
int m = Convert.ToInt32(textBox2.Text);
double r2 = qiangdu1.F(m);

hanshu qiangdu3 = new hanshu();
int n = Convert.ToInt32(textBox3.Text);
double r3 = qiangdu1.F(n);

Graphics gra = this.pictureBox1.CreateGraphics();
Pen pen = new Pen(Color.Pink);
gra.DrawEllipse(pen, 10, 10, Convert.ToInt32(r1), Convert.ToInt32(r1));
gra.DrawEllipse(pen, 20, 10, Convert.ToInt32(r2), Convert.ToInt32(r2));
gra.DrawEllipse(pen, 10, 20, Convert.ToInt32(r3), Convert.ToInt32(r3));
}
}

class hanshu
{
public double F(int x)
{
const double a1 = 30.58;
const double b1 = -110.7;
const double c1 = 27.96;
double f = a1 * Math.Exp(-((x - b1) / c1) * ((x - b1) / c1));
return f;
}
}
}
得分:0

得分:0

得分:0

得分:0

• 6
• 1/1页
• 1