Home > Net >  C # forced into "input string format is not correct"
C # forced into "input string format is not correct"

Time:12-27

Simple calculator with the teacher based on the thought of c + +, data structure, but when programming to such mistakes

 
Private void btn_ right parenthesis _Click (object sender, EventArgs e)
{
TextBox1. Text +=") ";

Bool flag=true;
OPND. Push (txtDisplay. Text);
TxtDisplay. Text="";
Op2=") ";
While (flag)
{
If (OPND. Count & gt;
=2){

Op1=the Convert. ToString (OPTR. Pop ());

If (Isp (op1) & gt; The Icp (op2))
{
Num2=the Convert. ToDouble (OPND. Pop ());
Num1=the Convert. ToDouble (OPND. Pop ());
If (op1=="+")
{
Tempresult=num1 + num2;
}
Else if (op1=="-")
{
Tempresult=num1 - num2;
}
Else if (op1=="x")
{
Tempresult num2=num1 *;
}
Else if (op1=="present")
{
Tempresult=num1/num2;
}
OPND. Push (Convert. ToString (tempresult));
}
Else if (Isp (op1)==Icp (op2))
{
flag=false;
}
}

This is the place where running error, click on the right bracket and then according to the equal sign will appear this kind of mistake,
Have not learned c #, because only learn c + +, looking for half a day on the Internet, library, did not find the book for a solution,
But somewhere else forced into is no problem, only the results of their calculations and Push into stack force transformation after the Pop, appear this kind of problem again after

I hope you bosses in order to solve this small problem, I this small white

CodePudding user response:

Push a pop two error, of course
  •  Tags:  
  • C#
  • Related