📄 compliermain.java
字号:
package net.csksoft.util.expcomp;
import org.omg.CORBA.*;
import javax.swing.*;
//Finish CodeFans.net
public class ComplierMain{
public static void main(String[] args) {
ExpComplier comp = new ExpComplier();
String exp=JOptionPane.showInputDialog("Please Input the expression:","12.11+23*2-2*-3*(4.4+3/4)");
if (exp==null) return;
comp.SetExpression(exp);
if (!comp.Complie())
{
JOptionPane.showMessageDialog(null, "Compile err:\n" +comp.GetLastError() );
return;
}
DoubleHolder ansHolder = new DoubleHolder();
if (!comp.calc(ansHolder))
{
JOptionPane.showMessageDialog(null, "Exec err:\n" +comp.GetLastError() );
}
else
{
String tmpStr = new String();
tmpStr = "The Answer of \"" + comp.GetExpression() +"\" is :";
tmpStr += ansHolder.value;
JOptionPane.showMessageDialog(null, tmpStr);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -