close
        %E6%93%B7%E5%8F%96.PNG  
           


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";
        }
arrow
arrow
    全站熱搜

    god4862791350 發表在 痞客邦 留言(0) 人氣()