老陈 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. ...
随机推荐
- GridView 鼠标经过时变色两种方法
第一种: 新建一个js文件 并引用 <script src="jquery.js" type="text/javascript"></scri ...
- WPF—TreeView无限极绑定集合形成树结构
1.如图所示:绑定树效果图 2.前台Xaml代码: <Window x:Class="WpfTest.MainWindow" xmlns="http://schem ...
- form表单无刷新提交文件(iframe)
先看一段代码(PHP例子) 1.表单代码(form.html): <iframe name="testIframeName" style="display:none ...
- ThinkPHP之中的图片上传操作
直接上个例子,其中包括有单图片文件上传.多图片文件上传.以及删除文件的一些操作.放置删除数据库的时候,仅仅删除掉了数据库之中的文件路径.而不是一并删除服务器之中的文件.放置服务器爆炸... TP里面c ...
- php读取文件时多了个%uFEFF[bom字符],怎样去掉?
今天从记事本文件中读取静态生成记录时,发现读出来的第一个链接打开的时候总是提示非法操作,把鼠标放到链接上发现链接的前面多了个%uFEFF, 百度一查,原来这是好多人都有遇到过的bom头问题,特地记录下 ...
- linux expect初识
写个命令,让ssh服务器便捷点 #!/usr/bin/expect set type [lindex $argv 0] if {$type == "server"} { set i ...
- Delphi XE5 for android 使用 BITMAP STYLE DESIGNER 改变控件背景
一.BITMAP STYLE DESIGNER 工具集成在IDE开发工具的TOOLS菜单. 使用NEW 新建一个安卓样式.NEW—NEW ANDROID STYLE FOR FIREMONKEY. 这 ...
- 学习simple.data之进阶篇
一.结果排序 -OrderBy(升序) -OrderByDescending(降序) db.Product.All().OrderByFactoryName(); db.Product.All().O ...
- 开始认真学计算机网络----computer network学习笔记(一)
什么是计算机网络,就是连一堆计算机,计算机不单单指pc,还包括打印机啦,手机啦巴拉巴拉一堆 为什么要连,share data共享数据 数据? 文档,图片,视频,巴拉巴拉 网络有什么类型? LAN--- ...
- Java学习中,常用的命令管理(Java 学习中的小记录)
Java学习中,常用的命令管理 作者:王可利(Star·星星) 一.Window中常见的dos命令 在哪里操作dos命令: Win7 ---> 开始 ---->所有程序---& ...