using System;
using System.Collections.Generic;
using
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication31
{
public partial class Form1 : Form
{
public static double x = 0.0, y = 0.0,s = 0.0,z = 0.0;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
x = Convert.ToDouble(textBox1.Text);
textBox1.Clear();
textBox1.Focus();
z = 1;
}
private void button5_Click(object sender, EventArgs e)
{
textBox1.Clear();
textBox1.Focus();
}
private void button6_Click(object sender, EventArgs e)
{
if (z == 1)
{
y = Convert.ToDouble(textBox1.Text);
textBox1.Clear();
textBox1.Focus();
s = x + y;
textBox1.Text = Convert.ToString(s);
}
if (z == 2)
{
y = Convert.ToDouble(textBox1.Text);
textBox1.Clear();
textBox1.Focus();
s = x - y;
textBox1.Text = Convert.ToString(s);
}
if (z == 3)
{
y = Convert.ToDouble(textBox1.Text);
textBox1.Clear();
textBox1.Focus();
s = x * y;
textBox1.Text = Convert.ToString(s);
}
if (z == 4)
{
y = Convert.ToDouble(textBox1.Text);
textBox1.Clear();
textBox1.Focus();
s = x / y;
textBox1.Text = Convert.ToString(s);
}
}
private void button2_Click(object sender, EventArgs e)
{
x = Convert.ToDouble(textBox1.Text);
textBox1.Clear();
textBox1.Focus();
z = 2;
}
private void button3_Click(object sender, EventArgs e)
{
x = Convert.ToDouble(textBox1.Text);
textBox1.Clear();
textBox1.Focus();
z = 3;
}
private void button4_Click(object sender, EventArgs e)
{
x = Convert.ToDouble(textBox1.Text);
textBox1.Clear();
textBox1.Focus();
z = 4;
}
}
}
我做的,这个还不够完善,看懂了的话完善很简单。