Код.
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 WindowsFormsApplication1 { public partial class Form1 : Form { public Form1() { InitializeComponent(); }
double a, b, result; private void button1_Click(object sender, EventArgs e) { a = Convert.ToDouble(textBox1.Text); b = Convert.ToDouble(textBox2.Text); label1.Text = "Сумма"; result = a + b; textBox3.Text = Convert.ToString(result); }
private void button2_Click(object sender, EventArgs e) { a = Convert.ToDouble(textBox1.Text); b = Convert.ToDouble(textBox2.Text); label1.Text = "Разность"; result = a - b; textBox3.Text = Convert.ToString(result); } private void button3_Click(object sender, EventArgs e) { label1.Text = "Произведение"; textBox3.Text = Convert.ToString(Convert.ToDouble(textBox1.Text) * Convert.ToDouble(textBox2.Text)); } private void button4_Click(object sender, EventArgs e) { a = Convert.ToDouble(textBox1.Text); b = Convert.ToDouble(textBox2.Text); label1.Text = "Частное"; result = a / b; textBox3.Text = Convert.ToString(result); }
private void button5_Click(object sender, EventArgs e) { textBox3.Text = Convert.ToString(Convert.ToDouble(textBox1.Text) * Convert.ToDouble(textBox1.Text)); }
private void button6_Click(object sender, EventArgs e) { textBox3.Text = Convert.ToString(Math.Sqrt(Convert.ToDouble(textBox1.Text))); }
} }
|