c#弄了简单计算器,想问如何多次运算.double a, b; double flag; public Form1() { InitializeComponent(); } private void button10_Click(object sender, EventArgs e) { textBox1.Te

来源:学生作业帮助网 编辑:作业帮 时间:2024/05/08 12:09:26
c#弄了简单计算器,想问如何多次运算.double a, b;        double flag;        public Form1()        {            InitializeComponent();        }        private void button10_Click(object sender, EventArgs e)        {            textBox1.Te
xn@_(lK:Io)@%42˙FU%$J"DB (ЗfW`Jkf:#es矓ًw;^wgu黧OvX.]F&jUb6 %XΚD7`lݷLbU1*5["J|T`sT1:APfuBN?(l

c#弄了简单计算器,想问如何多次运算.double a, b; double flag; public Form1() { InitializeComponent(); } private void button10_Click(object sender, EventArgs e) { textBox1.Te
c#弄了简单计算器,想问如何多次运算.
double a, b;
double flag;
public Form1()
{
InitializeComponent();
}
private void button10_Click(object sender, EventArgs e)
{
textBox1.Text = textBox1.Text + "0";
}
private void button11_Click(object sender, EventArgs e)
{
b = Convert.ToDouble(textBox1.Text);

if (flag == 1)
textBox1.Text = Convert.ToString(a + b);
if (flag == 2)
textBox1.Text = Convert.ToString(a - b);
if (flag == 3)
textBox1.Text = Convert.ToString(a * b);
if (flag == 4)
textBox1.Text = Convert.ToString(a / b);


}
private void button12_Click(object sender, EventArgs e)
{
textBox1.Text = "";
}
private void button13_Click(object sender, EventArgs e)
{
a = Convert.ToDouble(textBox1.Text);
flag = 4;
textBox1.Text = "";
}
private void button1_Click(object sender, EventArgs e)
{
textBox1.Text = textBox1.Text + "1";
}
private void button2_Click(object sender, EventArgs e)
{
textBox1.Text = textBox1.Text + "2";
}
private void button3_Click(object sender, EventArgs e)
{
textBox1.Text = textBox1.Text + "3";
}
private void button4_Click(object sender, EventArgs e)
{
textBox1.Text = textBox1.Text + "4";
}
private void button5_Click(object sender, EventArgs e)
{
textBox1.Text = textBox1.Text + "5";
}
private void button6_Click(object sender, EventArgs e)
{
textBox1.Text = textBox1.Text + "6";
}
private void button7_Click(object sender, EventArgs e)
{
textBox1.Text = textBox1.Text + "7";
}
private void button8_Click(object sender, EventArgs e)
{
textBox1.Text = textBox1.Text + "8";
}
private void button9_Click(object sender, EventArgs e)
{
textBox1.Text = textBox1.Text + "9";
}
private void button16_Click(object sender, EventArgs e)
{
a = Convert.ToDouble(textBox1.Text);
flag = 1;
textBox1.Text = "";
}
private void button15_Click(object sender, EventArgs e)
{
a = Convert.ToDouble(textBox1.Text);
flag = 2;
textBox1.Text = "";
}
private void button14_Click(object sender, EventArgs e)
{
a = Convert.ToDouble(textBox1.Text);
flag = 3;
textBox1.Text = "";

c#弄了简单计算器,想问如何多次运算.double a, b; double flag; public Form1() { InitializeComponent(); } private void button10_Click(object sender, EventArgs e) { textBox1.Te
(a+b)*c 这样的?+ - * / ( )有个优先级表,然后判断输出优先级