fscanf(Temp,"%f",&looker); /*如果是A,则是操作数*/
FPush(looker,Operands);
Pop(Whereat);
}
else if (Top(Whereat) == 'B'){
fscanf(Temp," ",&spacefinder); /*如果是B,则是运算符*/
Op = getc(Temp);
switch(Op){ /* 判断是什么运算符*/
case('^'): /*幂运算*/
NumB = FTop(Operands);
FPop(Operands);
if (FIsEmpty(Operands)){ /*错误处理*/
PrintError = 1;
}
else{
NumA = FTop(Operands);
FPop(Operands);
if ((NumA == 0 && NumB < 0)||((NumA<0)
&& (NumB - (int)NumB != 0)))
{
PrintError = 1;
}
else{
answer = pow(NumA,NumB);
FPush(answer,Operands);
}
}
break;
case '%': /*取模运算*/
NumB = FTop(Operands);
FPop(Operands);
if (FIsEmpty(Operands)){ /*错误处理*/
PrintError = 1;
}
else{
NumA = FTop(Operands);
FPop(Operands);
if ((NumA - (int)NumA != 0) || (NumB - (int)NumB != 0)
|| (NumB == 0))
{
PrintError = 1;
}
else{
answer = (int)NumA % (int)NumB; /* x mod b*/
FPush(answer,Operands);
}
}
break;
case '*': /*乘法运算*/
NumB = FTop(Operands);
FPop(Operands);
if (FIsEmpty(Operands)){
PrintError = 1;
}
else{
NumA = FTop(Operands);
FPop(Operands);
answer = NumA * NumB; /* x * y*/
FPush(answer,Operands);
}
break;
case '/': /*除法运算*/
NumB = FTop(Operands);
FPop(Operands);
if (FIsEmpty(Operands)){
PrintError = 1;
&nbs