c#简易计算器源代码!
{
if (textBox1.Text == "0" || flag == 1)
{
textBox1.Text = "9"; flag = 0;
}
else
{ textBox1.Text = textBox1.Text + "9"; }
button16.Focus();
}
private void button10_Click(object sender, EventArgs e)
{
if (textBox1.Text == "0." || flag == 1)
{
textBox1.Text = "0"; flag = 0;
}
else
{ textBox1.Text = textBox1.Text + "0"; }
button16.Focus();
}
private void button12_Click(object sender, EventArgs e)
{
flag = 1;
dh = 0;
yscs++;
num2 = Convert.ToDouble(textBox1.Text);
switch (ysf)
{
case 1: textBox1.Text = (num1 + num2).ToString(); break; case 2: textBox1.Text = (num1 - num2).ToString(); break; case 3: textBox1.Text = (num1 * num2).ToString(); break; case 4: if (num2 == 0)
{
MessageBox.Show("分母不能为0");
}
textBox1.Text = (num1 / num2).ToString(); break;
}
ysf = 1;
num1 = Convert.ToDouble(textBox1.Text);
button16.Focus();