最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
设计的一个计算器类的源代码,很简陋哦,请各位高手不要见笑!
时间:2022-07-02 18:02:22 编辑:袖梨 来源:一聚教程网
//名字空间MyCalClass
//类名: CalClass
//无参的构造函数CalClass()
//6个用到的私有变量
//void PointClick() 按小数点
//string CE() 是计算器复位用的,clear函数
//string BackSpace(string Txt) 倒退键,参数是计算过程中现在显示的计算结果
//string NumClick(string Txt,int NumKey) 0-9数字键按下的响应,Txt是计算的当前结果,NumKey是按下的数字值
//string OpClick(string Txt,int OpKey) +,-,*,/,=几个键按下时的处理,Txt是计算的当前结果,OpKey是按下操作键的数字ID
namespace MyCalClass
{
public class CalClass
{
private string ResultTxt; //Get and Show The Result of the TextBox in application
private bool PointIsDown; //If the radix point was clicked;
private double MidResult; //To Store middle results
private double Results; //To store finally result
private int LastClick; //To sign last clicking button class,is number(1) or operator(2)
private int LastOperator; //To sign last clicked button of operator is who?0 is Null,1 is +,2 is - ,3 is *,4 is /,5 is =;
public CalClass()
{
ResultTxt = "0.";
PointIsDown = false;
MidResult = 0;
Results = 0;
LastClick = 0;
相关文章
- 《彩色点点战争》推图常用三大主c玩法详解 01-23
- 《燕云十六声》池鱼林木任务攻略 01-23
- 《大连地铁e出行》查看行程记录方法 01-23
- 《明日方舟》2025春节限定干员余角色介绍 01-23
- 《崩坏:星穹铁道》万敌光锥搭配攻略 01-23
- 《燕云十六声》一药千金任务攻略 01-23