您的位置:首页 > 其它

web窗体的运用

2015-11-24 22:58 169 查看
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace WebApplication1
{
interface chapter
{
int answer { get; }

}

class Charp : chapter
{
private int x1;
private int x2;
private string Operator;
public int result;
public Charp(int x1, int x2, string Operator)
{
this.x1 = x1;
this.x2 = x2;
this.Operator = Operator;

}
public int answer
{
get
{

if (Operator == "+")
{
result = x1 + x2;

}
if (Operator == "-")
{

result = x1 - x2;

}
if (Operator == "*")
{

result = x1 * x2;

}
if (Operator == "/")
{

result = x1 / x2;

}
return result;
}

}

}

}


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace WebApplication1
{
public partial class WebForm1 : System.Web.UI.Page
{

protected void Button1_Click1(object sender, EventArgs e)
{

Charp a = new Charp(int.Parse(TextBox1.Text), int.Parse(TextBox3.Text), TextBox2.Text);

if (TextBox4.Text == Convert.ToString(a.answer))
{

Response.Write("<script>alert('回答正确')</script>");

}
else
{

Response.Write("<script>alert('回答错误')</script>");
}

}
}
}








总结:

这回做的这个web有些简单,只是简单的调用了一下,就是陈老师你说的换脸,所以也比较快十分钟就做好了。其实只要想好程序的显示界面如何表达,再与代码串联起来就行了,但是我们有时候遇到的问题就是不知道怎么把如何把显示界面与代码关联。简单的说就是不知道用哪个控件好;然后知道哪个用控件,然后又会在其他地方遇到困难,对于一个软件的整体设计的逻辑不明确。例如这个我们实现计算器功能,我的同学遇到了这样的问题,刚开始想着先把这个输入的题目显示在一个控件里, 然后先不想读取的时候。然后题目出来了,判断又是一个问题了,然后在截取字符串的问题上一直过不去。到最后放弃了,改用其他方法判断储存。

我所说的我们的最大问题就是,对于软件整体思想我们把握的不够,对于我们所掌握的基本知识也不够。具体就是这样了
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: