c#超详细计算器代码.docx
《c#超详细计算器代码.docx》由会员分享,可在线阅读,更多相关《c#超详细计算器代码.docx(10页珍藏版)》请在三一办公上搜索。
1、c#超详细计算器代码C#超详细计算器源代码 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace 计算器 public partial class Form1 : Form int flag = 0; do
2、uble num1 = 0, num2 = 0; int ysf = 0, dh = 0, yscs = 0; public Form1 InitializeComponent; private void button1_Click(object sender, EventArgs e) if (textBox1.Text = 0 | flag = 1) textBox1.Text = 1; flag = 0; else textBox1.Text = textBox1.Text + 1; private void button2_Click(object sender, EventArgs
3、e) if (textBox1.Text = 0 | flag = 1) textBox1.Text = 2; flag = 0; else textBox1.Text = textBox1.Text + 2; button16.Focus; private void button3_Click(object sender, EventArgs e) if (textBox1.Text = 0 | flag = 1) textBox1.Text = 3; flag = 0; else textBox1.Text = textBox1.Text + 3; button16.Focus; priv
4、ate void button4_Click(object sender, EventArgs e) if (textBox1.Text = 0 | flag = 1) textBox1.Text = 4; flag = 0; else textBox1.Text = textBox1.Text + 4; button16.Focus; private void button5_Click(object sender, EventArgs e) if (textBox1.Text = 0 | flag = 1) textBox1.Text = 5; flag = 0; else textBox
5、1.Text = textBox1.Text + 5; button16.Focus; private void button6_Click(object sender, EventArgs e) if (textBox1.Text = 0 | flag = 1) textBox1.Text = 6; flag = 0; else textBox1.Text = textBox1.Text + 6; button16.Focus; private void button7_Click(object sender, EventArgs e) if (textBox1.Text = 0 | fla
6、g = 1) textBox1.Text = 7; flag = 0; else textBox1.Text = textBox1.Text + 7; button16.Focus; private void button8_Click(object sender, EventArgs e) if (textBox1.Text = 0 | flag = 1) textBox1.Text = 8; flag = 0; else textBox1.Text = textBox1.Text + 8; button16.Focus; private void button9_Click(object
7、sender, EventArgs e) if (textBox1.Text = 0 | flag = 1) textBox1.Text = 9; flag = 0; else textBox1.Text = textBox1.Text + 9; button16.Focus; private void button10_Click(object sender, EventArgs e) if (textBox1.Text = 0. | flag = 1) textBox1.Text = 0; flag = 0; else textBox1.Text = textBox1.Text + 0;
8、button16.Focus; private void button12_Click(object sender, EventArgs e) flag = 1; dh = 0; yscs+; num2 = Convert.ToDouble(textBox1.Text); switch (ysf) case 1: textBox1.Text = (num1 + num2).ToString; break; case 2: textBox1.Text = (num1 - num2).ToString; break; case 3: textBox1.Text = (num1 * num2).To
9、String; break; case 4: if (num2 = 0) MessageBox.Show(分母不能为0); textBox1.Text = (num1 / num2).ToString; break; ysf = 1; num1 = Convert.ToDouble(textBox1.Text); button16.Focus; private void button13_Click(object sender, EventArgs e) flag = 1; dh = 0; yscs+; num2 = Convert.ToDouble(textBox1.Text); switc
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- c# 详细 计算器 代码
链接地址:https://www.31ppt.com/p-3060364.html