c#程序怎么编写数字0的代码和小数点的代码?
usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Da...
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace 计算器
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
int add1, add2, sum;
private void button1_Click(object sender, EventArgs e)
{
Button a = (Button)sender;
textBox1.Text = textBox1.Text.Trim() + a.Text;
}
private void buttonClear_Click(object sender, EventArgs e)
{
add1 = 0;
add2 = 0;
sum = 0;
textBox1.Text = "";
label1.Text = "";
}
private void buttonE_Click(object sender, EventArgs e)
{
add2 = Convert.ToInt32(textBox1.Text.Trim());
sum = add1 + add2;
label1.Text += add2.ToString() + "=";
textBox1.Text = sum.ToString();
}
private void buttonAdd_Click(object sender, EventArgs e)
{
add1 = Convert.ToInt32(textBox1.Text.Trim());
textBox1.Clear();
label1.Text = add1.ToString() + "+";
}
}
}
菜鸟不懂,求指教,尽量按照上面的套路来 展开
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace 计算器
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
}
int add1, add2, sum;
private void button1_Click(object sender, EventArgs e)
{
Button a = (Button)sender;
textBox1.Text = textBox1.Text.Trim() + a.Text;
}
private void buttonClear_Click(object sender, EventArgs e)
{
add1 = 0;
add2 = 0;
sum = 0;
textBox1.Text = "";
label1.Text = "";
}
private void buttonE_Click(object sender, EventArgs e)
{
add2 = Convert.ToInt32(textBox1.Text.Trim());
sum = add1 + add2;
label1.Text += add2.ToString() + "=";
textBox1.Text = sum.ToString();
}
private void buttonAdd_Click(object sender, EventArgs e)
{
add1 = Convert.ToInt32(textBox1.Text.Trim());
textBox1.Clear();
label1.Text = add1.ToString() + "+";
}
}
}
菜鸟不懂,求指教,尽量按照上面的套路来 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询