欢迎来到天天文库
浏览记录
ID:31708258
大小:57.36 KB
页数:6页
时间:2019-01-17
《c#控制台计算器代码》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、usingSystem;usingSystem.Collections.Generic;usingSystem.ComponentModel;usingSystem.Data;usingSystcm.Drawing;usingSystem.Linq;usingSystem.Text;usingSystem.Windows.Forms;namespaceCaculator(publicpartialclassForm1:Form{publicstringokl;publicintOperationType;publicdoubleokll,okl2;public
2、Form1(){lnitializeComponent();privatevoidbutton1_Click(objectsender,EventArgse)〃退格(Jif(textBoxl.Text==
3、
4、textBoxl.Text==H0H){textBoxl.Text=tM,;1else{okll=Convert.ToDouble(textBox1.Text);okl=Convert.ToString((okll-okll%10)/10);textBoxl.Text=okl;)privatevoidbutton2_Click(objcctsender,E
5、ventArgsc)〃淸空按钮{一okl=,n,;textBoxI.Text=M0M;tcxtBoxl.Focus();1privatevoidbutton9_Click(objectsender,EventArgse)〃1按令H{if(textBoxl.Text==H0H)1okl二T;textBox1.Text=Convert.ToString(okI);}else{okl=okl+”1”;okl2=Convert.ToDoublc(ok1);textBoxl.Text=okl;)privatevoidbutton10_Click(objectsender
6、,EventArgse)//2if(textBoxl.Text==H0H){okl=n2H;tcxtBoxl.Tcxt=Convcrt.ToString(ok1);1else{okl=okl+M2n;okl2=Convert.ToDouble(ok1);lexlBoxl.Text=okl;)}privatevoidbutton1l_Click(objectsender,EventArgse)〃3fJif(tcxtBoxl.Tcxt==H0H)1okl=0;textBoxl.Text=Convert.ToString(ok1);}else{okl=okl+”3”
7、;okl2=Convert.ToDoublc(ok1);textBox1.Text=okl;}}privatevoidbutton6_Click(objectsender,EventArgse)//4Iif(textBox1.Text=©){okl=H4H;textBoxl.Text=Convert.ToString(ok1);}else1okl=okl+”4”;ok!2=Convert.ToDouble(okl);tcxtBoxl.Tcxt=okl;1}privatevoidbutton5_Click(objcctsender,EventArgsc)//5(
8、if(textBoxl.Text==H0H){okl=H5H;textBoxl.Text=Convert.ToString(ok1);1elseokl=okl+”5”;okl2=Convert.ToDouble(ok1);textBoxl.Text=ok1;privatevoidbutton8_Click(objcctsender,EventArgsc)//6{一if(textBoxl.Text==H0H){okl=H6M;textBoxI.Text=Convert.ToString(ok1);}else{okl=okl+”6”;okl2=Converl.To
9、Double(ok1);textBoxl.Text=okl;1}privatevoidbutton3_Click(objectsender,EventArgse)//7IJif(textBoxl.Text==n0H){okl=n7M;textBoxl.Text=Convcrt10、l.Text==H0H)1okl=H8
10、l.Text==H0H)1okl=H8
此文档下载收益归作者所有