it is reverse POLISH notation :nerdy-face:

This commit is contained in:
2026-01-11 02:54:43 +05:00
parent 490dc23027
commit 8f065abb81
2 changed files with 4 additions and 4 deletions

View File

@@ -144,7 +144,7 @@
{
if (currentOperand != "") equation.Add(new Token(Token.TokenType.Operand, currentOperand));
buttonEquals.Text = "#";
currentOperand = ReverseNotationSolver.Solve(equation);
currentOperand = ReversePolishNotationSolver.Solve(equation);
UpdateLabels();
}
}

View File

@@ -1,8 +1,8 @@
namespace Lunar.Evil_Calculator
{
internal static class ReverseNotationSolver
internal static class ReversePolishNotationSolver
{
private static List<Token> ToReverseNotation(List<Token> equation)
private static List<Token> ToReversePolishNotation(List<Token> equation)
{
List<Token> reversedEquation = new List<Token>();
Stack<Token> operators = new Stack<Token>();
@@ -47,7 +47,7 @@
public static string Solve(List<Token> originalEquation)
{
List<Token> reversedEquation = ToReverseNotation(originalEquation);
List<Token> reversedEquation = ToReversePolishNotation(originalEquation);
Stack<Token> stack = new Stack<Token>();
foreach (Token token in reversedEquation)
{