private void radioButton1_CheckedChanged(object sender, EventArgs e) { int a = 1, b = 2; int c; if (radioButton1.Checked == true) { c = a + b; radioButton2.Checked = false; } if (radioButton2.Checked == true) { c = a - b; radioButton2.Checked = false; } }
判断是摁下了radiobutton1还是radiobutton2,然后点击按钮输出c,该怎么写呢
解决方案
30
你要么把c改全局变量,要么直接写button的click事件里