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 label2_Click(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
string a1, a2;
a1 = textBox1.Text;
a2 = textBox2.Text;
int b1 = Int32.Parse(a1);
int b2 = Int32.Parse(a2);
int c;
c = b1 + b2;
label2.Text = c.ToString();
}
private void textBox2_TextChanged(object sender, EventArgs e)
{
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
private void button2_Click(object sender, EventArgs e)
{
string a1, a2;
a1 = textBox1.Text;
a2 = textBox2.Text;
int b1 = Int32.Parse(a1);
int b2 = Int32.Parse(a2);
int c;
c = b1 - b2;
label2.Text = c.ToString();
}
private void button3_Click(object sender, EventArgs e)
{
string a1, a2;
a1 = textBox1.Text;
a2 = textBox2.Text;
int b1 = Int32.Parse(a1);
int b2 = Int32.Parse(a2);
int c;
c = b1 * b2;
label2.Text = c.ToString();
}
private void button4_Click(object sender, EventArgs e)
{
string a1, a2;
a1 = textBox1.Text;
a2 = textBox2.Text;
float b1 = float.Parse(a1);
float b2 = float.Parse(a2);
float c;
if (b2 == 0)
{
label2.Text = "錯誤";
}
else
{
c = b1 / b2;
label2.Text = c.ToString();
}
}
}
}
文章標籤
全站熱搜
留言列表