close
private void button1_Click(object sender, EventArgs e)
{
string a, b;
float c;
a = textBox1.Text;
b = textBox2.Text;
float a1 = float.Parse(a);
float a2 = float.Parse(b);
c = a1+a2 ;
label2.Text = c.ToString();
}
private void button2_Click(object sender, EventArgs e)
{
string a, b;
float c;
a = textBox1.Text;
b = textBox2.Text;
float a1 = float.Parse(a);
float a2 = float.Parse(b);
c = a1 - a2;
label2.Text = c.ToString();
}
private void button3_Click(object sender, EventArgs e)
{
string a, b;
float c;
a = textBox1.Text;
b = textBox2.Text;
float a1 = float.Parse(a);
float a2 = float.Parse(b);
c = a1 * a2;
label2.Text = c.ToString();
}
private void button4_Click(object sender, EventArgs e)
{
string a, b;
float c;
a = textBox1.Text;
b = textBox2.Text;
float a1 = float.Parse(a);
float a2 = float.Parse(b);
c = a1 / a2;
label2.Text = c.ToString();
if (a2 == 0)
label2.Text = "除數不能為0";
}
全站熱搜
留言列表