diff --git "a/\344\275\234\344\270\232/.keep" "b/\344\275\234\344\270\232/.keep" new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git "a/\344\275\234\344\270\232/5.18---webc#\350\256\241\347\256\227\345\231\250\357\274\210\347\256\200\345\215\225\357\274\211.md" "b/\344\275\234\344\270\232/5.18---webc#\350\256\241\347\256\227\345\231\250\357\274\210\347\256\200\345\215\225\357\274\211.md" new file mode 100644 index 0000000000000000000000000000000000000000..a09413472fca76f29e2c2fe8317114a81efda89b --- /dev/null +++ "b/\344\275\234\344\270\232/5.18---webc#\350\256\241\347\256\227\345\231\250\357\274\210\347\256\200\345\215\225\357\274\211.md" @@ -0,0 +1,102 @@ +# 5.18---webc#计算器(简单) + +```c# +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; +using System.Web.UI; +using System.Web.UI.WebControls; + +namespace 计算器 +{ + public partial class WebForm1 : System.Web.UI.Page + { + protected void Page_Load(object sender, EventArgs e) + { + + } + double op1,op2, result = 0; + char op; + protected void Button2_Click(object sender, EventArgs e) + { + Label1.Text = "+"; + TextBox1.Enabled = false; + } + protected void Button3_Click(object sender, EventArgs e) + { + Label1.Text = "/"; + TextBox1.Enabled = false; + } + protected void Button4_Click(object sender, EventArgs e) + { + Label1.Text = "-"; + TextBox1.Enabled = false; + } + protected void Button5_Click(object sender, EventArgs e) + { + Label1.Text = "*"; + TextBox1.Enabled = false; + } + protected void Button1_Click(object sender, EventArgs e) + { + Label2.Text = "="; + TextBox2.Enabled = false; + op1 = double.Parse(TextBox1.Text); + op2 = double.Parse(TextBox2.Text); + op = Convert.ToChar(Label1.Text); + switch (op) + { + case '+': + result = op1 + op2; + TextBox3.Text = result.ToString(); + break; + case '-': + result = op1 - op2; + TextBox3.Text = result.ToString(); + break; + case '*': + result = op1 * op2; + TextBox3.Text = result.ToString(); + break; + case '/': + result = op1 / op2; + TextBox3.Text = result.ToString(); + break; + default: + break; + } + } + } +} +``` + +```html + + + + + + + 计算器 + + +
+
+ + + + +
+   +   +   +   +   +
+
+ + + +``` + diff --git "a/\347\254\224\350\256\260/.keep" "b/\347\254\224\350\256\260/.keep" new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391