谁有C#计算器代码?能实现简单的加减乘除,清除就行。谢谢!
using System;using System。Collections。Generic;using System。Drawing;using System。Windows。Forms;namespace windshadow14{ public partial class MainForm { int i =0; int a ; int b; int i1; long c; public static void Main(string[] args) { Application。 EnableVisualStyles(); Applica...全部
using System;using System。Collections。Generic;using System。Drawing;using System。Windows。Forms;namespace windshadow14{ public partial class MainForm { int i =0; int a ; int b; int i1; long c; public static void Main(string[] args) { Application。
EnableVisualStyles(); Application。SetCompatibleTextRenderingDefault(false); Application。Run(new MainForm()); } public MainForm() { InitializeComponent(); } void Button10Click(object sender, System。
EventArgs e) { if(textBox1。Text ==" ") { textBox1。Text =textBox1。Text "0"; } } void Button1Click(object sender, System。
EventArgs e) { textBox1。Text =textBox1。Text "1"; if(textBox1。Text==" ") { textBox1。Text =textBox1。
Text "1"; } } void Button2Click(object sender, System。EventArgs e) { textBox1。Text =textBox1。
Text "2"; if(textBox1。Text==" ") { textBox1。Text =textBox1。Text "2"; } } void Button3Click(object sender, System。
EventArgs e) { textBox1。Text =textBox1。Text "3"; if(textBox1。Text ==" ") { textBox1。Text =textBox1。
Text "3"; } } void Button4Click(object sender, System。EventArgs e) { textBox1。Text =textBox1。
Text "4"; if(textBox1。Text==" ") { textBox1。Text =textBox1。Text "4"; } } void Button5Click(object sender, System。
EventArgs e) { textBox1。Text =textBox1。Text "5"; if(textBox1。Text ==" ") { textBox1。Text =textBox1。
Text "5"; } } void Button6Click(object sender, System。EventArgs e) { textBox1。Text =textBox1。
Text "6"; if(textBox1。Text==" ") { textBox1。Text =textBox1。Text "6"; } } void Button7Click(object sender, System。
EventArgs e) { textBox1。Text =textBox1。Text "7"; if(textBox1。Text ==" ") { textBox1。Text =textBox1。
Text "7"; } } void Button8Click(object sender, System。EventArgs e) { textBox1。Text =textBox1。
Text "8"; if(textBox1。Text ==" ") { textBox1。Text =textBox1。Text "8"; } } void Button9Click(object sender, System。
EventArgs e) { textBox1。Text =textBox1。Text "9"; if(textBox1。Text ==" ") { textBox1。Text =textBox1。
Text "9"; } } void TextBox1TextChanged(object sender, System。EventArgs e) { if(i==1||i==2||i==3||i==4) { textBox1。
Text =" "; } i=0; } void Button12Click(object sender, System。EventArgs e) { i=1; a =int 。
Parse (textBox1。Text); i1=1; } void Button16Click(object sender, System。EventArgs e) { b=int。
Parse (textBox1。Text ); textBox1。Text =" "; switch(i1) { case 1: c =a b ; break ; case 2: c =a -b ; break; case 3: c =a *b ; break; case 4: c =a /b ; break; } textBox1。
Text =c。ToString (); i=0; a=0; b=0; i1=0; } void Button13Click(object sender, System。
EventArgs e) { i1=2; i=1; a =int 。Parse (textBox1。Text); } void MainFormLoad(object sender, System。
EventArgs e) { } void Button14Click(object sender, System。EventArgs e) { i1=3; i=3; a =int 。
Parse (textBox1。Text); } void Button15Click(object sender, System。EventArgs e) { i1=4; i=4; a =int 。
Parse (textBox1。Text); } }}。收起