第一个页面

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. crontab的使用说明

    网上瞎转载的,仅供参考 名称 : crontab 使用权限 : 所有使用者 使用方式 : crontab file [-u user]-用指定的文件替代目前的crontab. crontab-[-u ...

  2. silverlight 获取路径 config

    1.获取web.config配置内容: web.config default.aspx protected string InitParams { get; set; } InitParams = s ...

  3. hive到hbase的使用

    一.简单介绍 hive的元数据保存在metastore里面,真实的数据一般位于hdfs中,可以通过hql来对数据进行分析.hbase中的数据也是存放在hdfs上的,可不可以使用hive来分析hbase ...

  4. Cassandra 有限分页策略

    瀑布式分页 如果你的应用只需要瀑布式的分页,那么,Cassandra可以很好的支持,不过记得要指定好排序顺序. CLUSTERING ORDER BY (add_time DESC); 常见的分页,跳 ...

  5. Spark和Hadoop作业之间的区别

    Spark目前被越来越多的企业使用,和Hadoop一样,Spark也是以作业的形式向集群提交任务,那么在内部实现Spark和Hadoop作业模型都一样吗?答案是不对的. 熟悉Hadoop的人应该都知道 ...

  6. DOS下无法调出中文输入法-Solved

    From:http://www.cnblogs.com/killerlegend/p/3750542.html Author:KillerLegend Date:2014.5.24 DOS下无法打开中 ...

  7. Learning Scrapy笔记(五)- Scrapy登录网站

    摘要:介绍了使用Scrapy登录简单网站的流程,不涉及验证码破解 简单登录 很多时候,你都会发现你需要爬取数据的网站都有一个登录机制,大多数情况下,都要求你输入正确的用户名和密码.现在就模拟这种情况, ...

  8. Python科学计算利器——Anaconda

    (搬运自我在SegmentFault的博客) 最近在用Python做中文自然语言处理.使用的IDE是PyCharm.PyCharm确实是Python开发之首选,但用于科学计算方面,还略有欠缺.为此我尝 ...

  9. C++ 的全局构造与析构函数

    我们知道一般的C/C++ 的程序是从main函数开始的,然后在main函数结束后程序结束.但是不然,在main函数开始执行前,已经有其他的指令被执行了. 为了程序的顺利执行,首先要初始化执行环境,比如 ...

  10. android 连续点击退出程序

    package com.test.twiceexit; import java.util.Timer; import android.app.Activity;import android.os.Bu ...