Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Astro1123 committed Dec 11, 2021
1 parent aaf582c commit 40085e0
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions calc/rpn/ToRPN.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,12 +57,16 @@ public ArrayList<String> toRPN(ArrayList<String> inlist,ArrayList<String> typeli
break;
}
}
if (tp1 > tp2) break;
/*
if (mode) {
if (tp1 >= tp2) break;
} else {
if (tp1 > tp2) break;
}
//*/
if (stack.size()==0) break;
if (mode && tp2 == 100 && tp1 == 100) break;
list.add(stack.pop());
}
stack.push(inlist.get(i));
Expand Down Expand Up @@ -152,12 +156,12 @@ public ArrayList<String> toRPN(ArrayList<String> inlist,ArrayList<String> typeli
private void oplinit(OperatorList opl, boolean mode) {
if (mode == true) {
opl.list.add(opl.InputOperatorList("*",70));
opl.list.add(opl.InputOperatorList("/",71));
opl.list.add(opl.InputOperatorList("//",71));
opl.list.add(opl.InputOperatorList("%",71));
opl.list.add(opl.InputOperatorList("%%",71));
opl.list.add(opl.InputOperatorList("/",70));
opl.list.add(opl.InputOperatorList("//",70));
opl.list.add(opl.InputOperatorList("%",70));
opl.list.add(opl.InputOperatorList("%%",70));
opl.list.add(opl.InputOperatorList("+",60));
opl.list.add(opl.InputOperatorList("-",61));
opl.list.add(opl.InputOperatorList("-",60));
opl.list.add(opl.InputOperatorList("=",0));
opl.list.add(opl.InputOperatorList("(",0));
opl.list.add(opl.InputOperatorList(",",0));
Expand Down

0 comments on commit 40085e0

Please sign in to comment.