C编的计算器.docVIP

  • 3
  • 0
  • 约7.79千字
  • 约 10页
  • 2017-02-09 发布于重庆
  • 举报
C编的计算器

网络程序设计 作业(三) 学院:教育科学与技术学院 班级:10级教计三班 姓名:张敏 学号:100401041334 日期:2011年11月7日 在线计算器的设计与实现 一、界面设计 1.界面截图如下: 2.设计步骤: (1)打开Visual Web Developer 2008软件,把“default.aspx”重命名为“zaixianjisuanji.aspx”。 (2)打开该项的设计界面,在div块标签中输入“在线计算器”。(3)在工具箱拖入一个文本框TextBox,在属性栏中设置其属性值。 (4)拖入一个Table控件,设置其行列分别为5,4。并设置其大小边框值等。 (5)在每个格子里拖入一个button按钮控件,在第五行合并前两个单元格。并如上图设置其Text的值。 二、程序设计 using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; public partial class _Default : System.Web.UI.Page {private Calulate obj1; public void Page_Load(object sender, EventArgs e) { if (!IsPostBack) {Calulate obj1 = new Calulate(); ViewState[result] = obj1; } else { obj1 = ViewState[result] as Calulate; } } public void sum(float a) { if (obj1.s != -) { if (obj1.b == 1) obj1.d = a; else { obj1.d = obj1.d * 10 + a; } ViewState[result] = obj1; } else { if (obj1.b == 1) obj1.d = -a; else { obj1.d = obj1.d * 10 - a; } ViewState[result] = obj1; } } //四则运算 public void sum1(float a) { if (obj1.c == true obj1.a == false) { obj1.result = a; ViewState[result] = obj1; } if (obj1.sign == + obj1.c == false obj1.a == true) { obj1.result = obj1.result + a; ViewState[result] = obj1; } if (obj1.sign == - obj1.c == false obj1.a == true) { obj1.result = obj1.result - a; ViewState[result] = obj1; } if (obj1.sign == * obj1.c == false obj1.a == true) { obj1.result = obj1.result * a; ViewState[result] = obj1; } if (obj1.sign == / obj1.c == false obj1.a == true) { obj1.result = obj1.result / a; ViewState[result] = obj1; } } //数字键 protected void Button18_Click(object sender, EventArgs

文档评论(0)

1亿VIP精品文档

相关文档