c#弄了简单计算器,想问如何多次运算.double a, b; double flag; public Form1() { InitializeComponent(); } private void button10_Click(object sender, EventArgs e) { textBox1.Te
来源:学生作业帮助网 编辑:作业帮 时间:2024/06/20 12:16:23
![c#弄了简单计算器,想问如何多次运算.double a, b; double flag; public Form1() { InitializeComponent(); } private void button10_Click(object sender, EventArgs e) { textBox1.Te](/uploads/image/z/8380073-65-3.jpg?t=c%23%E5%BC%84%E4%BA%86%E7%AE%80%E5%8D%95%E8%AE%A1%E7%AE%97%E5%99%A8%2C%E6%83%B3%E9%97%AE%E5%A6%82%E4%BD%95%E5%A4%9A%E6%AC%A1%E8%BF%90%E7%AE%97.double+a%2C+b%3B++++++++double+flag%3B++++++++public+Form1%28%29++++++++%7B++++++++++++InitializeComponent%28%29%3B++++++++%7D++++++++private+void+button10_Click%28object+sender%2C+EventArgs+e%29++++++++%7B++++++++++++textBox1.Te)
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 这样的?+ - * / ( )有个优先级表,然后判断输出优先级