老陈 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. ...
随机推荐
- oracle的表名、字段名、constraint名的长度限制分别是多少?
文章出处:http://blog.csdn.net/haiross/article/details/38379615 Oracle:表名.字段名.constraint名的长度有限制 oracle 的命 ...
- ASP.NET相关技术整理
- js对象与this指向
创建对象的方法 1.对象字面量法 var obj={} var obj={ 'first-name':'Tom', 'last-name':'bush', age:24, Family:{ Broth ...
- php 获取文件后缀名
$file_ext = strtolower(substr(strrchr($upload_file, '.'), 1)); strrchr:查找指定字符在字符串中的最后一次出现 string str ...
- 删:[CentOS 7] 安装nginx
下载对应当前系统版本的nginx包(package) # wget http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-cent ...
- Delphi7中编译提示“Unsafe type 'PChar'”的原因及处理办法
delphi7中加入了对.net的支持 在.net中是没有指针的(托管环境中),所以指针都是不安全的,不符合.net规范 所以d7里有警告,可以不管它 DELPHI7已经考虑到了移植到点NET的问题, ...
- 导购效果跟踪: SPM
什么是SPM SPM是淘宝社区电商业务(xTao)为外部合作伙伴(外站)提供的一套跟踪引导成交效果数据的解决方案. 下面是一个跟踪点击到宝贝详情页的引导成交效果数据的SPM示例: http://det ...
- JS中的DOM与BOM
javascript组成: 1. ECMAScript 基本语法. 2. BOM (浏览器对象模型) 3. DOM (文档对象模型) 一)BOM(borwser Object Model) 浏览器对 ...
- 10 款提高开发效率的 jQuery/CSS3 组件
前端开发是一项十分繁琐而又耗体力的工作,如何更有效率的开发我们的应用,很多人会选择适当地使用一些jQuery插件.今天就要给大家分享10款可以提高开发效率的jQuery/CSS3组件.部分插件可以下载 ...
- ED/EP系列1《简介》
电子存折(ED:ElectronicDeposit)一种为持卡人进行消费.取现等交易而设计的支持个人识别码(PIN)保护的金融IC卡应用.它支持圈存.圈提.消费和取现等交易. 电子钱包(EP:Elec ...