欢迎来到天天文库
浏览记录
ID:40914717
大小:32.00 KB
页数:3页
时间:2019-08-10
《同方2011专转本计算机》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、namespaceW_{publicpartialclassForm1:Form{boolisDotpressed=false;decimaldOpDaTa1,dOpDaTa2,dreguet;charcOperator;publicForm1(){InitializeComponent();}privatevoidbt9_Click(objectsender,EventArgse){tbregust.Text=tbregust.Text+"9";}privatevoidbt8_Click(objectsender,E
2、ventArgse){tbregust.Text=tbregust.Text+"8";}privatevoidbt7_Click(objectsender,EventArgse){tbregust.Text=tbregust.Text+"7";}privatevoidbt6_Click(objectsender,EventArgse){tbregust.Text=tbregust.Text+"6";}privatevoidbt5_Click(objectsender,EventArgse){tbregust.Text=
3、tbregust.Text+"5";}privatevoidbt4_Click(objectsender,EventArgse){tbregust.Text=tbregust.Text+"4";}privatevoidbt3_Click(objectsender,EventArgse){tbregust.Text=tbregust.Text+"3";}privatevoidbt2_Click(objectsender,EventArgse){tbregust.Text=tbregust.Text+"2";}privat
4、evoidbt1_Click(objectsender,EventArgse){tbregust.Text=tbregust.Text+"1";}privatevoidbutton1_Click(objectsender,EventArgse){if(!isDotpressed){tbregust.Text=tbregust.Text+".";isDotpressed=true;}}privatevoidbutton10_Click(objectsender,EventArgse)(加法输入){dOpDaTa1=dec
5、imal.Parse(tbregust.Text);tbregust.Text="";isDotpressed=false;cOperator='+';}privatevoidbtcal_Click(objectsender,EventArgse)(等于)输入{dOpDaTa2=decimal.Parse(tbregust.Text);switch(cOperator){case'+':dreguet=dOpDaTa1+dOpDaTa2;tbregust.Text=dreguet.ToString();break;ca
6、se'-':(分号)dreguet=dOpDaTa1-dOpDaTa2;tbregust.Text=dreguet.ToString();break;default:(分号)break;}}privatevoidbtsub_Click(objectsender,EventArgse)(减法){dOpDaTa1=decimal.Parse(tbregust.Text);tbregust.Text="";isDotpressed=false;cOperator='-';}}}
此文档下载收益归作者所有