第一个页面

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.IO;
public partial class _Default : System.Web.UI.Page
{ protected void Page_Load(object sender, EventArgs e)
{ }
protected void Button1_Click(object sender, EventArgs e)
{ StreamWriter n1 = File.AppendText("C:\\n1.txt");
n1.WriteLine(TextBox1.Text);
n1.Close();
StreamWriter n2 = File.AppendText("C:\\n2.txt");
n2.WriteLine(TextBox2.Text);
n2.Close();
StreamWriter n3 = File.AppendText("C:\\n3.txt");
n3.WriteLine(TextBox3.Text);
n3.Close();
ListBox1.Items.Add(TextBox1.Text + TextBox2.Text + TextBox3.Text + "\n");
TextBox1.Text = "";
TextBox2.Text = "";
TextBox3.Text = "";
}
protected void Button2_Click(object sender, EventArgs e)
{//跳转页面
Response.Redirect("Default2.aspx");
}
}

  第二个页面

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
public partial class Default2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{ }//开始
public static int Count = 0;
public static int right = 0;
//总计的个数和正确的个数
int m = 0;
protected void Button1_Click(object sender, EventArgs e)
{
//出题
string[] n1 = new string[100];
n1 = File.ReadAllLines("C:\\n1.txt");
TextBox1.Text = n1[m];
string[] n2 = new string[100];
n2 = File.ReadAllLines("C:\\n2.txt");
TextBox2.Text = n2[m];
string[] n3 = new string[100];
n3 = File.ReadAllLines("C:\\n3.txt");
TextBox3.Text = n3[m];
m++;
}
protected void Button2_Click(object sender, EventArgs e)
{
TextBox4.Enabled = false;
Response.Write("运算结束!");
TextBox5.Text = Default2.Count.ToString();//题目总数
TextBox6.Text = Default2.right.ToString();
TextBox7.Text = ((Default2.right / (double)(Default2.Count)) * 100).ToString() + "%";//正确率
} protected void Button4_Click(object sender, EventArgs e)
{
int a = int.Parse(TextBox1.Text);
int b = int.Parse(TextBox3.Text);
Char c = Convert.ToChar(TextBox2.Text);
Class1 con = new Class1();
con.chu(a, b, c);
if (con.answer == int.Parse(TextBox4.Text))
{
Response.Write("回答正确!下一题请按开始按钮!");
right++;
Count++;
}
else
{
Response.Write("回答错误!下一题请按开始按钮!");
Count++;
}
}
}

  .net的封装

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web; /// <summary>
///Class1 的摘要说明
/// </summary>
public class Class1
{
public Class1()
{ //
//TODO: 在此处添加构造函数逻辑
//
}
public int sum;
public int answer
{
get
{
return sum;
}
} public int chu(int n1, int n2, char fuhao)
{
if (fuhao == '+')
{
return sum = n1 + n2;
}
else if (fuhao == '-')
{
return sum = n1 - n2;
}
else if (fuhao == '*')
{
return sum= n1 * n2;
}
return sum; }
}

  运行后

老陈 ASP.NET封装的更多相关文章

  1. 老陈 WPF

    using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.W ...

  2. (l老陈-小石头)典型用户、用户故事、用例图

    一.典型用户 老陈 小石头 二.用户故事 老陈:作为一个家长,我希望能利用软件在电脑上储存一些数学题目,以便在繁忙的工作中也能帮助到孩子提高数学. 小石头:作为一个小学二年级的小学生,我希望能利用软件 ...

  3. win2003 老的ASP程序报错 Microsoft OLE DB Provider for Orac(0x80004005)

    ASP连接ORACLE报错,记得环境刚配置完成的时候一切正常,今天莫名其妙的报错了 报错位置78行: 这是一个很老的系统,代码没人去东,只是从老的机器迁移到新的服务器中,想想应该是环境的问题 网上搜索 ...

  4. 使用NetBox实现ASP网页封装为EXE教程

    简单的形容就是把ASP文件打包 成一个EXE文件,并且不需要在调试的机器上安装IIS即可正常调试.如果按照说明书来操作的话,观看比较繁琐,本人为方便大家使用,现制作一个简单的使用教程. 封装过程 1. ...

  5. 老陈---谈Delphi中SSL协议的应用[转]

    摘要:本文主要介绍如何在Delphi中使用SSL协议.一共分为七个部分:(1)SSL协议是什么?(2)Delphi中如何使用SSL协议?(3)SSL客户端编程实例.(4)SSL服务端编程实例.(5)S ...

  6. ASP.net封装

    设计如下: 代码: using System; using System.IO; public partial class 四则运算 : System.Web.UI.Page { protected ...

  7. Asp.net封装js的类

    using System; using System.Collections.Generic; using System.Text; using System.Web; using System.We ...

  8. .net,C#,Vb,F#,Asp,Asp.net区别以及作用和方向

    .net是平台,其他都是运行在其.NET FrameWork环境下的 C#,Vb都是语言运行在.net 平台下 Asp,Asp.net 都是用来写Web网页的,但是Asp和Asp.net有区别 Asp ...

  9. ASP.NET Linux部署(2) - MS Owin + WebApi + Mono + Jexus

    ASP.NET Linux部署(2) - MS Owin + WebApi + Mono + Jexus 本文承接我的上一篇博文: ASP.NET 5 Linux部署,那篇文章主要是针对最新的ASP. ...

随机推荐

  1. Linux shell实现Mysql异地备份数据库

    #--------------------------Mysqldump异地备份-----------------# #!/bin/bash #start mysqldump back /usr/bi ...

  2. aspx页面中用Input 标签实现上传图片功能

    实现上传图片功能需单独的建立一个aspx页面, 其中前台页面需要注意两点: a)实现上传功能的input的type="file" b)设置请求报文头为 enctype=" ...

  3. mutex 简单介绍

    “mutex”是术语“互相排斥(mutually exclusive)”的简写形式,也就是互斥量. 当两个或更多线程需要同时访问一个共享资源时,系统需要使用同步机制来确保一次只有一个线程使用该资源.M ...

  4. vue中的重要特性

    一.vue中的自定义组件 html的代码: <!DOCTYPE html> <html lang="en"> <head> <meta c ...

  5. 【转】MYISAM表批量压缩

    关于对MYISAM表的压缩,可以使用myisampack和myisamchk完成(myisampack完之后必须进行myisamchk才能使用压缩后的表,而且是只读的), 其详细地用法可以参考官方文档 ...

  6. JSON (仅限本地)

    <script type="text/javascript"> setInterval(function() { $("#content").loa ...

  7. Tomcat工作原理

    http://www.cnblogs.com/shootercheng/p/5838645.html

  8. 共享内存shared pool (4):Library cache 转储文件

    上一篇blog只是从概念上理解Library cache,本篇则是将Library cache从内存中dump出来,看看其结构. 基本命令 ALTER SESSION SET EVENTS 'imme ...

  9. MVC中Model,不仅仅只是数据的传递者

    在Model使用的时候很多人回向以前写三层架构一样使用它,将Model作为数据的传递者. 比如常见的写法 public int Id { get; set; } public int RoleId { ...

  10. (转)Android网络命令

    转自:http://www.cnblogs.com/shunyao8210/archive/2010/08/10/1796214.html ifconfig 1.       作用 ifconfig用 ...