ImageVerifierCode 换一换
格式:DOCX , 页数:18 ,大小:16.92KB ,
资源ID:8130375      下载积分:3 金币
快捷下载
登录下载
邮箱/手机:
温馨提示:
快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。 如填写123,账号就是123,密码也是123。
特别说明:
请自助下载,系统不会自动发送文件的哦; 如果您已付费,想二次下载,请登录后访问:我的下载记录
支付方式: 支付宝    微信支付   
验证码:   换一换

加入VIP,免费下载
 

温馨提示:由于个人手机设置不同,如果发现不能下载,请复制以下地址【https://www.bdocx.com/down/8130375.html】到电脑端继续下载(重复下载不扣费)。

已注册用户请登录:
账号:
密码:
验证码:   换一换
  忘记密码?
三方登录: 微信登录   QQ登录  

下载须知

1: 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。
2: 试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。
3: 文件的所有权益归上传用户所有。
4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
5. 本站仅提供交流平台,并不能对任何下载内容负责。
6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

版权提示 | 免责声明

本文(C 编程 科学计算器.docx)为本站会员(b****5)主动上传,冰豆网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知冰豆网(发送邮件至service@bdocx.com或直接QQ联系客服),我们立即给予删除!

C 编程 科学计算器.docx

1、C 编程 科学计算器using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;namespace Calculator public partial class Counter : Form public Counter() InitializeComponent(); double num1, num2; double result=0;

2、 int op; int flag=0;/开始标志 int sp = 0;/判断除数为零时移除监听 int max = 0;/范围标识 int eq=0; #region 功能键 private void on_Click(object sender, EventArgs e)/开始 flag = 1; sp = 0; max = 0; this.numInput.Text = 0; this.txtInput.Text = ; private void off_Click(object sender, EventArgs e)/关闭 flag = 0; sp = 0; max = 0; th

3、is.numInput.Text = ; this.txtInput.Text = ; private void button9_Click(object sender, EventArgs e)/删除 max = 0; if (flag = 1&sp=0) string numstring = this.numInput.Text; if (numstring.Length 0) string temp = numstring.Substring(0, numstring.Length - 1); this.numInput.Text = temp.ToString(); else this

4、.numInput.Text = 0; private void clear_Click(object sender, EventArgs e)/c清零 max = 0; if (flag = 1) sp = 0; this.numInput.Text = 0; this.txtInput.Text = ; private void delete_Click(object sender, EventArgs e)/清零 max = 0; if (flag = 1) sp = 0; this.numInput.Text = 0; #endregion #region 运算符 private vo

5、id equal_Click(object sender, EventArgs e)/等号 eq = 1; if (flag = 1 & sp = 0) max = 0; num2 = Convert.ToDouble(this.numInput.Text); this.txtInput.Text += num2.ToString(); this.txtInput.Text += =; txtInput.Text = null; switch (op) case 1: result = num1 + num2; break; case 2: result = num1 - num2; brea

6、k; case 3: result = num1 * num2; break; case 4: result = num1 / num2; break; case 5: result = Math.Pow(num1, num2); break; case 6: result = Mod(num1, num2); break; default: return; if (op = 4&num2 = 0) this.numInput.Text = 除数不能为0; sp = 1; else /this.txtInput.Text += result.ToString(); this.numInput.

7、Text = result.ToString(); private void sub_Click(object sender, EventArgs e)/减法 max = 0; if (flag = 1 & sp = 0) num1 = Convert.ToDouble(this.numInput.Text); this.txtInput.Text += num1.ToString(); numInput.Text = ; this.txtInput.Text += -; op = 2; private void mul_Click(object sender, EventArgs e)/乘法

8、 max = 0; if (flag = 1 & sp = 0) num1 = Convert.ToDouble(this.numInput.Text); this.txtInput.Text += num1.ToString(); this.numInput.Text = ; this.txtInput.Text += *; op = 3; private void divide_Click(object sender, EventArgs e)/除法 max = 0; if (flag = 1 & sp = 0) num1 = Convert.ToDouble(this.numInput.

9、Text); this.txtInput.Text += num1.ToString(); this.numInput.Text = ; this.txtInput.Text += /; op = 4; private void plus_Click(object sender, EventArgs e)/加法 max = 0; if (flag = 1 & sp = 0) num1 = Convert.ToDouble(this.numInput.Text); this.txtInput.Text += num1.ToString(); numInput.Text = ; this.txtI

10、nput.Text += +; op = 1; public double Mod(double x, double y)/取模运算 max = 0; int temp = Convert.ToInt32(x / y); return (x - y * temp); private void power_Click(object sender, EventArgs e)/幂运算 max = 0; if (flag = 1 & sp = 0) num1 = Convert.ToDouble(numInput.Text); this.txtInput.Text += num1.ToString()

11、; this.numInput.Text = ; this.txtInput.Text += ; op = 5; private void recip_Click(object sender, EventArgs e)/倒数 max = 0; if (flag = 1 & sp = 0) num1 = Convert.ToDouble(this.numInput.Text); double temp = 0; temp = 1 / num1; this.txtInput.Text = 1/ + num1.ToString() + =; this.numInput.Text = temp.ToS

12、tring(); private void percent_Click(object sender, EventArgs e) max = 0; if (flag = 1 & sp = 0) /double temp = Convert.ToDouble(this.numInput.Text); /this.txtInput.Text += temp.ToString(); /temp = temp / 100; /this.numInput.Text = temp.ToString(); /this.txtInput.Text += %=; num1 = Convert.ToDouble(t

13、his.numInput.Text); this.txtInput.Text += num1.ToString(); this.numInput.Text = ; this.txtInput.Text += %; op = 6; #endregion #region 数字 private void one_Click(object sender, EventArgs e)/1 if (flag = 1 & sp = 0 & max = 0) if (this.numInput.Text = 0) this.numInput.Text = ; if (eq = 1) this.numInput.

14、Text = 1; eq = 0; else this.numInput.Text += 1; private void two_Click(object sender, EventArgs e)/2 if (flag = 1 & sp = 0 & max = 0) if (this.numInput.Text = 0) this.numInput.Text = ; if (eq = 1) this.numInput.Text = 2; eq = 0; else this.numInput.Text += 2; /this.txtInput.Text += 2; private void th

15、ree_Click(object sender, EventArgs e)/3 if (flag = 1 & sp = 0 & max = 0) if (this.numInput.Text = 0) this.numInput.Text = ; if (eq = 1) this.numInput.Text = 3; eq = 0; else this.numInput.Text += 3; /this.txtInput.Text += 3; private void four_Click(object sender, EventArgs e)/4 if (flag = 1 & sp = 0

16、& max = 0) if (this.numInput.Text = 0) this.numInput.Text = ; if (eq = 1) this.numInput.Text = 4; eq = 0; else this.numInput.Text += 4; / this.txtInput.Text += 4; private void five_Click(object sender, EventArgs e)/5 if (flag = 1 & sp = 0 & max = 0) if (this.numInput.Text = 0) this.numInput.Text = ;

17、 if (eq = 1) this.numInput.Text = 5; eq = 0; else this.numInput.Text += 5; /this.txtInput.Text += 5; private void six_Click(object sender, EventArgs e)/6 if (flag = 1 & sp = 0 & max = 0) if (this.numInput.Text = 0) this.numInput.Text = ; if (eq = 1) this.numInput.Text = 6; eq = 0; else this.numInput

18、.Text += 6; /this.txtInput.Text += 6; private void seven_Click(object sender, EventArgs e)/7 if (flag = 1 & sp = 0 & max = 0) if (this.numInput.Text = 0) this.numInput.Text = ; if (eq = 1) this.numInput.Text = 7; eq = 0; else this.numInput.Text += 7; /this.txtInput.Text += 7; private void eight_Clic

19、k(object sender, EventArgs e)/8 if (flag = 1 & sp = 0 & max = 0) if (this.numInput.Text = 0) this.numInput.Text = ; if (eq = 1) this.numInput.Text = 8; eq = 0; else this.numInput.Text += 8; /this.txtInput.Text += 8; private void night_Click(object sender, EventArgs e)/9 if (flag = 1 & sp = 0 & max =

20、 0) if (this.numInput.Text = 0) this.numInput.Text = ; if (eq = 1) this.numInput.Text = 9; eq = 0; else this.numInput.Text += 9; /this.txtInput.Text += 9; private void zero_Click(object sender, EventArgs e)/0 if (flag = 1 & sp = 0 & max = 0) if (this.numInput.Text = 0) this.numInput.Text = ; if (eq

21、= 1) this.numInput.Text = 0; eq = 0; else this.numInput.Text += 0; /this.txtInput.Text += 0; private void dian_Click(object sender, EventArgs e)/小数点 if (flag = 1 & sp = 0 & max = 0) if (eq = 1) this.numInput.Text = .; eq = 0; else this.numInput.Text += .; /this.txtInput.Text += .; #endregion #region

22、 三角函数 private void sin_Click(object sender, EventArgs e)/sin if (flag = 1 & sp = 0) num1 = Convert.ToDouble(this.numInput.Text); double temp = Math.PI * (num1 / 180); this.txtInput.Text += sin( + num1 + )=; num1 = Math.Sin(temp); this.numInput.Text = num1.ToString(); /this.txtInput.Text += num1.ToSt

23、ring(); private void cos_Click(object sender, EventArgs e)/cos if (flag = 1 & sp = 0) num1 = Convert.ToDouble(this.numInput.Text); double temp = Math.PI * (num1 / 180); this.txtInput.Text += cos( + num1 + )=; num1 = Math.Cos(temp); this.numInput.Text = num1.ToString(); private void tan_Click(object

24、sender, EventArgs e)/tan if (flag = 1 & sp = 0) num1 = Convert.ToDouble(this.numInput.Text); double temp = Math.PI * (num1 / 180); this.txtInput.Text += tan( + num1 + )=; num1 = Math.Tan(temp); this.numInput.Text = num1.ToString(); #endregion #region 帮助 private void 关于产品ToolStripMenuItem_Click(objec

25、t sender, EventArgs e) MenuAbout about = new MenuAbout(); about.Show(); private void change_Click(object sender, EventArgs e) max = 0; if (flag = 1&sp = 0) num1 = Convert.ToDouble(this.numInput.Text); num1 = -num1; this.numInput.Text = num1.ToString(); private void 使用手册ToolStripMenuItem_Click(object

26、 sender, EventArgs e) MenuUse use = new MenuUse(); use.Show(); #endregion #region 皮肤 private void 皮肤1ToolStripMenuItem_Click(object sender, EventArgs e) skinEngine1.SkinFile = Application.StartupPath + Calmness.ssk; private void 皮肤2ToolStripMenuItem_Click(object sender, EventArgs e) skinEngine1.Skin

27、File = Application.StartupPath + DeepCyan.ssk; private void 皮肤3ToolStripMenuItem_Click(object sender, EventArgs e) skinEngine1.SkinFile = Application.StartupPath + Eighteen.ssk; private void 皮肤4ToolStripMenuItem_Click(object sender, EventArgs e) skinEngine1.SkinFile = Application.StartupPath + GlassGreen.ssk; private void 皮肤5ToolStripMenuItem_Click(object sender, EventArgs e) skinEngine1.SkinFile = Application.StartupPath + Silver.ssk; #endregion #region 复制粘贴 private void 复制ToolStripMenuItem_

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1