老陈 ASP.NET封装
第一个页面
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封装的更多相关文章
- 老陈 WPF
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.W ...
- (l老陈-小石头)典型用户、用户故事、用例图
一.典型用户 老陈 小石头 二.用户故事 老陈:作为一个家长,我希望能利用软件在电脑上储存一些数学题目,以便在繁忙的工作中也能帮助到孩子提高数学. 小石头:作为一个小学二年级的小学生,我希望能利用软件 ...
- win2003 老的ASP程序报错 Microsoft OLE DB Provider for Orac(0x80004005)
ASP连接ORACLE报错,记得环境刚配置完成的时候一切正常,今天莫名其妙的报错了 报错位置78行: 这是一个很老的系统,代码没人去东,只是从老的机器迁移到新的服务器中,想想应该是环境的问题 网上搜索 ...
- 使用NetBox实现ASP网页封装为EXE教程
简单的形容就是把ASP文件打包 成一个EXE文件,并且不需要在调试的机器上安装IIS即可正常调试.如果按照说明书来操作的话,观看比较繁琐,本人为方便大家使用,现制作一个简单的使用教程. 封装过程 1. ...
- 老陈---谈Delphi中SSL协议的应用[转]
摘要:本文主要介绍如何在Delphi中使用SSL协议.一共分为七个部分:(1)SSL协议是什么?(2)Delphi中如何使用SSL协议?(3)SSL客户端编程实例.(4)SSL服务端编程实例.(5)S ...
- ASP.net封装
设计如下: 代码: using System; using System.IO; public partial class 四则运算 : System.Web.UI.Page { protected ...
- Asp.net封装js的类
using System; using System.Collections.Generic; using System.Text; using System.Web; using System.We ...
- .net,C#,Vb,F#,Asp,Asp.net区别以及作用和方向
.net是平台,其他都是运行在其.NET FrameWork环境下的 C#,Vb都是语言运行在.net 平台下 Asp,Asp.net 都是用来写Web网页的,但是Asp和Asp.net有区别 Asp ...
- ASP.NET Linux部署(2) - MS Owin + WebApi + Mono + Jexus
ASP.NET Linux部署(2) - MS Owin + WebApi + Mono + Jexus 本文承接我的上一篇博文: ASP.NET 5 Linux部署,那篇文章主要是针对最新的ASP. ...
随机推荐
- C#winform初试报表
步骤1.新建一个窗口,拖一个ReportViewer控件上去,设置该控件的Dock为Fill. 步骤2.添加一个报表文件,如:Report1.rdlc,设置其中的参数,这里设置的参数和下面的代码里面的 ...
- 《第一行代码--Android》阅读笔记之界面设计
1.单位dp.dip.sp.pt.px.in.mm 这里引用StackOverFlow上的一个解答: px is one pixel. sp is scale-independent pixels. ...
- js----全局变量和局部变量部分讲解
以此文作为自己学习的一个总结. 关于全局变量和局部变量的一句简单的定义:在函数外声明的变量都为全局变量,在函数内声明的为局部变量. 一.局部变量和全局变量重名会覆盖全局变量 var a = 1; fu ...
- php常用函数集锦[备份用的]
1.判断是否正确的日期格式 /** * 是否正确的日期 * * @access public */ private function _isdate($str,$format="Y-m-d ...
- andoroid项目使用Javah找不到class问题
比如目录结构是:Soffice\bin\classes\cn\com\isoffice\util\SofficeWebService.class 进入到bin/classes 下使用命令 javah ...
- C++primer 阅读点滴记录(三)
14章 操作符重载和转换 重载操作符是具有特殊名称的函数:保留字operator后接需要定义的操作符符号. 1.重载的操作符名: + – * / % ^ & | ~ ! , = < & ...
- MIS2000 Lab,我的IT人生与职场--从零开始的前十五年 与 我的微创业
http://www.dotblogs.com.tw/mis2000lab/archive/2014/09/16/ithome_2014_ironman.aspx [IT邦幫忙]鐵人賽 -- MIS2 ...
- ok6410的DMA裸机总结
1.为何使用DMA:为了提高CPU的工作效率,避免多余的等待时间 2.关于DMA控制器:(1)通道数:2440有4个通道,6410有4个DMA控制器(初始化的时候要选择),32个通道.210有两种DM ...
- JSTL实现分页
JSTL(JSP Standard Tag Library ,JSP标准标签库)是一个不断完善的开放源代码的JSP标签库,是由apache的jakarta小组来维护的.JSTL只能运行在支持JSP1. ...
- 算法系列4《Luhn》
Luhn算法由IBM的Hans Peter Luhn发明,又称为"模10"算法,是一种简单的校验和算法,用来验证识别号,一般会被用于身份证号码,信用卡号.IMEI号.社会保险号的验 ...