close

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 WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}

private void Form1_Load(object sender, EventArgs e)
{

}

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";
}

private void textBox1_TextChanged(object sender, EventArgs e)
{

}

private void label2_Click(object sender, EventArgs e)
{

}
}
}    14  

arrow
arrow
    全站熱搜

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