To:
Private void Button13_Click (object sender, EventArgs e)
{
//subtraction
If (txtBox1. Text=="")
{
MessageBox. Show (" There must be one numerator ");
}
The else
{
S3=input. The Substring (input. The Length - 1, 1);
If (Judge & amp; & S3!=". ")//(k==1)
SymbolInput (' - ');
ShowMessage ();
Judge=false;//k +=1;
Dotjudge=true;
Num=1;
}
}
Private void Button14_Click (object sender, EventArgs e)
{
//the multiplication;
If (txtBox1. Text=="")
{
MessageBox. Show (" There must be one numerator ");
}
The else
{
S3=input. The Substring (input. The Length - 1, 1);
If (Judge & amp; & (s3!=""))//(k==1)
SymbolInput (' * ');
ShowMessage ();
Judge=false;
Dotjudge=true;
Num=1;
}
}
Private void Button15_Click (object sender, EventArgs e)
{
//division;
If (txtBox1. Text=="")
{
MessageBox. Show (" There must be one numerator ");
}
The else
{
S3=input. The Substring (input. The Length - 1, 1);
If (Judge & amp; & S3!=". ")//(k==1)
SymbolInput ('/');
ShowMessage ();
Judge=false;
Dotjudge=true;
Num=1;
}
}
Private void Button17_Click (object sender, EventArgs e)
{
//to empty;
Input="";
TxtBox1. Text="";
ShowMessage ();
TxtBox1. ReadOnly=false;
TxtBox2. Text="";
Num=1;
}
Private void Button18_Click (object sender, EventArgs e)
{
//backspace
If (input Length & gt; 0)
{txtBox1. Text=input. The Substring (0, input. The Length - 1); }
The else
{txtBox1. Text=""; }
Input=txtBox1. Text;
Num=1;
}
Private void Button19_Click (object sender, EventArgs e)
{
//left parenthesis;
Judge=true;
LeftBracketInput (' (');
ShowMessage ();
}
Private void Button20_Click (object sender, EventArgs e)
{
//right parenthesis;
If (txtBox1 Text!="")
{
Judge=true;
RightBracketInput ('));
ShowMessage ();
}
}
Private void Calculator_Load (object sender, EventArgs e)
{
TxtBox1. Focus ();
TxtBox1. TabIndex=0;
}
Private void Button16_Click (object sender, EventArgs e)
{
MSScriptControl. IScriptControl sc=new MSScriptControl. ScriptControlClass ();
Sc. Language="javascript";
String s;
S=txtBox1. Text;
Try
{
TxtBox2. Text=sc. Eval (s). The ToString ();
}
The catch (Exception)
{
MessageBox. Show (" Wrong Expression Input!" );
TxtBox1. Focus ();
TxtBox1. TabIndex=0;
}
}
}
}
CodePudding user response:
Encourage, come on!CodePudding user response: