1, the ASP needs to change a lot of places Ah, id this place is spent more than 20 minutes-----
2. The code is as follows
Using system;using system.collections.generic;using system.linq;using system.web;///<summary>///chouxiang Summary description///</summary> abstract class Wuyu {public class Operation {private double number A = 0; Private double numberb = 0; Public double Numbera {get {return numbera;} set {Numbera = value;} } public double Numberb {get {return numberb;} set {Numberb = value;} }} public abstract double Xiaole (double A, double b); } class Jiafa:wuyu {public override double Xiaole (double A, double b) {return a + B; }} class Jianfa:wuyu {public override double Xiaole (double A, double b) {Retu RN A-B; }} class Chengfa:wuyu {public override double Xiaole (double A, double b) {return a * b; }} class Chufa:wuyu {public override double Xiaole (double A, double b) {return A/ b } }
Using system;using system.collections.generic;using system.linq;using system.web;///<summary>///operation Summary description///</summary>public class operation{ Wuyu ww=null; Public operation (String Fuhao) { switch (Fuhao) {case "+": jiafa g = new Jiafa (); WW = g; break; Case "-": jianfa u = new Jianfa (); ww = u; break; Case "*": chengfa a = new Chengfa (); WW = A; break; Case "/": chufa n = new Chufa (); WW = n; break; } } Public double result (double a,double b) { return ww.xiaole (b);} }
Using system;using system.collections.generic;using system.linq;using system.web;using System.Web.UI;using System.web.ui.webcontrols;using system.io;using System.text.regularexpressions;public partial class _Default: system.web.ui.page{public int i; public static int count; public static int right; protected void Page_Load (object sender, EventArgs e) {} public void Duqu () {String path = @ "d:\\ compute storage. txt"; String[] line = file.readalllines (path); if (I < line. Length) {TextBox1.Text = Line[i]; } else {Response.Write ("already done"); }} protected void button1_click (object sender, EventArgs e) {Duqu () ; } protected void Button3_Click (object sender, EventArgs e) {Duqu (); i++; string xx = TextBox1.Text; StRing SS = @ "(\d+) (\s+) + (\d+)"; Match mast = Regex.match (xx, SS); This regular expression has no solution to int strnumbera = Int. Parse (Mast. GROUPS[1]. Value); String Strnumberc = Mast. GROUPS[2]. Value; int strnumberb = Int. Parse (Mast. GROUPS[3]. Value); Double x = convert.todouble (Strnumbera); String Z =textbox2.text; Double y = convert.todouble (Strnumberb); Operation op = new operation (STRNUMBERC); Double res = Op.result (x, y); String Daan = convert.tostring (res); if (Daan = = Z) {Response.Write ("Congratulations ha, you are right"); right++; } else {Response.Write ("SFASDF" +daan); } TextBox2.Text = ""; count++; } protected void Button2_Click (object sender, EventArgs e) {textbox4.text = right. ToString (); Textbox5.text = count. ToString (); Textbox7.text = (rigHT/(Double) (count)) * 100). ToString () + "%"; }}
ASP. NET Calculator (policy mode)