同方2011专转本计算机
(3页)
本资源提供全文预览,点击全文预览即可全文预览,如果喜欢文档就下载吧,查找使用更方便哦!
9.9 积分
namespace W_{ public partial class Form1 : Form { bool isDotpressed = false; decimal dOpDaTa1, dOpDaTa2, dreguet; char cOperator; public Form1() { InitializeComponent(); } private void bt9_Click(object sender, EventArgs e) { tbregust.Text = tbregust.Text + "9"; } private void bt8_Click(object sender, EventArgs e) { tbregust.Text = tbregust.Text + "8"; } private void bt7_Click(object sender, EventArgs e) { tbregust.Text = tbregust.Text +"7"; } private void bt6_Click(object sender, EventArgs e) { tbregust.Text = tbregust.Text + "6"; } private void bt5_Click(object sender, EventArgs e) { tbregust.Text = tbregust.Text + "5"; } private void bt4_Click(object sender, EventArgs e) { tbregust.Text = tbregust.Text + "4"; } private void bt3_Click(object sender, EventArgs e) { tbregust.Text = tbregust.Text + "3"; } private void bt2_Click(object sender, EventArgs e) { tbregust.Text = tbregust.Text + "2"; } private void bt1_Click(object sender, EventArgs e) { tbregust.Text = tbregust.Text + "1"; } private void button1_Click(object sender, EventArgs e) { if (!isDotpressed) { tbregust.Text = tbregust.Text + "."; isDotpressed = true; } } private void button10_Click(object sender, EventArgs e)(加法输入) { dOpDaTa1 = decimal.Parse(tbregust.Text); tbregust.Text = ""; isDotpressed = false; cOperator='+'; } private void btcal_Click(object sender, EventArgs e) (等于)输入 { dOpDaTa2 = decimal.Parse(tbregust.Text); switch(cOperator) { case'+': dreguet = dOpDaTa1 + dOpDaTa2; tbregust.Text = dreguet.ToString(); break; case'-': (分号) dreguet = dOpDaTa1 - dOpDaTa2; tbregust.Text = dreguet.ToString(); break; default: (分号) break; } } private void btsub_Click(object sender, EventArgs e) (减法) { dOpDaTa1 = decimal.Parse(tbregust.Text); tbregust.Text = ""; isDotpressed = false; cOperator = '-'; } }} 关 键 词: 同方 2011 计算机
天天文库所有资源均是用户自行上传分享,仅供网友学习交流,未经上传用户书面授权,请勿作他用。