已阅读5页,还剩3页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
功能看界面就是了, /后台代码C#using System;using System.Collections.Generic;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;namespace Calculator2 public partial class _Default : System.Web.UI.Page protected void Page_Load(object sender, EventArgs e) protected void Compute(object sender, EventArgs e) Double Pi = Math.PI; Double num1; Double num2; String str1,str2,str3; / Double result; int len; / Char c = +, -, *, / ; if (sender.Equals(BtnEqual) str1 = Loadstr1.Text; len = str1.Length; str2 =Loadstr2.Text; str3 = Loadstr3.Text; / char strArry = str1.ToCharArray(); num1 =Convert.ToDouble(str3); num2 = Convert.ToDouble(txtResult .Text); if (txtResult.Text = ) txtResult.Text = ; / num2=con switch (str1) case +: txtResult.Text = Convert.ToString( num2 + num1); break; case -: txtResult.Text = Convert.ToString( num1 - num2); break; case *: txtResult.Text = Convert.ToString( num1 * num2); break; case /: if (num2 = 0) txtResult.Text = 除数不能为0; else txtResult.Text = Convert.ToString(num1 / num2); break; /num2 = result; / txtResult.Text = Convert.ToString(num2); if (sender.Equals(BtnAdd) Loadstr1.Text =+; Loadstr3.Text = txtResult.Text; txtResult.Text = ; if (sender.Equals(BtnSub) Loadstr1.Text =-; Loadstr3.Text = txtResult.Text; txtResult.Text = ; if (sender.Equals(BtnMul) Loadstr1.Text = *; Loadstr3.Text = txtResult.Text; txtResult.Text = ; if (sender.Equals(BtnDivide) Loadstr1.Text = /; Loadstr3.Text = txtResult.Text; txtResult.Text = ; if (sender.Equals(Btn1) if (txtResult.Text = 0) txtResult.Text = 1; else txtResult.Text += 1; Loadstr2.Text = txtResult.Text; if (sender.Equals(Btn2) if (txtResult.Text = 0) txtResult.Text = 2; else txtResult.Text += 2; Loadstr2.Text = txtResult.Text; if (sender.Equals(Btn3) if (txtResult.Text = 0) txtResult.Text = 3; else txtResult.Text += 3; Loadstr2.Text = txtResult.Text; if (sender.Equals(Btn4) if (txtResult.Text = 0) txtResult.Text = 4; else txtResult.Text += 4; Loadstr2.Text = txtResult.Text; if (sender.Equals(Btn5) if (txtResult.Text = 0) txtResult.Text = 5; else txtResult.Text += 5; Loadstr2.Text = txtResult.Text; if (sender.Equals(Btn6) if (txtResult.Text = 0) txtResult.Text = 6; else txtResult.Text += 6; Loadstr2.Text = txtResult.Text; if (sender.Equals(Btn7) if (txtResult.Text = 0) txtResult.Text = 7; else txtResult.Text += 7; Loadstr2.Text = txtResult.Text; if (sender.Equals(Btn8) if (txtResult.Text = 0) txtResult.Text = 8; else txtResult.Text += 8; Loadstr2.Text = txtResult.Text; if (sender.Equals(Btn9) if (txtResult.Text = 0) txtResult.Text = 9; else txtResult.Text += 9; Loadstr2.Text = txtResult.Text; if (sender.Equals(Btn0) if (txtResult.Text = 0) txtResult.Text = 0; else txtResult.Text += 0; Loadstr2.Text = txtResult.Text; if (sender.Equals(BtnDot) if (txtResult.Text != ) /txtResult.Text = ; if (txtResult.Text.Contains(.) txtResult.Text = txtResult.Text; else txtResult.Text += .; Loadstr2.Text = txtResult.Text; if (sender.Equals(BtnClr) txtResult.Text = ; Loadstr1.Text = ; Loadstr2.Text = ; Loadstr3.Text = ; if (sender.Equals(BtnPi) txtResult.Text = Convert.ToString(Pi); Loadstr2.Text = txtResult.Text; if (sender.Equals(BtnSquareRoot) txtResult.Text = Convert.ToString(Math.Sqrt(Convert.ToDouble(txtResult.Text); if (sender.Equals(BtnSquare) txtResult.Text = Convert.ToString(Convert.ToDouble(txtResult.Text) * Convert.ToDouble(txtResult.Text); /前台代码 迷你计算器 #container border-bottom: solid 1px #5c9cc0; border-top: solid 1px #5c9cc0; border-left: solid 1px #5c9cc0; border-right: solid 1px #5c9cc0; font-size: 14px; width: 400px; height: 300px; text-align: center; background-color: #eef3f7; margin: 0px auto; .Button border-right: #7b9ebd 1px solid; padding-right: 2px; border-top: #7b9ebd 1px solid; padding-left: 2px; filter: progid:DXImageTransform.Microsoft.Gradient(GradientType=0, StartColorStr=#ffffff, EndColorStr=#cecfde); border-left: #7b9ebd 1px solid; cursor: hand; color: black; padding-top: 2px; border-bottom: #7b9ebd 1px solid; width: 50px; height: 30px; font-size: 14px; .TextBox width: 310px; height: 30px; text-align: right; vertical-align: bottom; font-size: 20px; #title font-family: 黑体; font-size: 18px; height: 18px; filter: blur(strength=2,direction=135); color: #6666ff; 迷你计算器
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 多子女房屋继承协议书
- 投资咨询协议书
- 室内盆景空气净化功能提升创新创业项目商业计划书
- 摩托车智能灯光系统创新创业项目商业计划书
- 改装车灯光智能控制系统创新创业项目商业计划书
- 射频眼科青光眼治疗设备创新创业项目商业计划书
- (2025)学习贯彻全国两会精神应知应会知识测试题与答案
- 【微课逐字稿】教育部金小玲名师工作室成员陈丹萍老师微课《班主任如何对学生进行个别教育?》逐字稿
- 2025年机器人技术的医疗机器人应用
- 部编人教版六年级上册语文第21课《文言文二则》教学设计
- 国家自然科学基金申请基金项目申请策略与技巧
- 2024-2025学年上海市市东实验学校高二下学期3月月考数学试卷
- 货物装卸操作规程及安全操作规范
- 尿毒症患者饮食健康宣教
- 假劣药题目及答案
- 税务师事务所管理制度
- 中国阻燃玻璃纤维行业市场前景预测及投资价值评估分析报告
- 托管服务机构转让协议书
- 人工智能在医学护理领域的应用与实践
- 土建工程施工合同协议书
- 签约办证协议书模板
评论
0/150
提交评论