Internal Test: Verify correct order of operations with mixed operators and parentheses.
ID: 1179
using uCalcSoftware;
var uc = new uCalc();
// This tests the precedence of power (^), multiplication (*), and addition (+).
// The correct evaluation is 5 + (2 * (3^2)) -> 5 + (2 * 9) -> 5 + 18 -> 23.
Console.WriteLine(uc.EvalStr("5 + 2 * 3^2"));
23 using uCalcSoftware; var uc = new uCalc(); // This tests the precedence of power (^), multiplication (*), and addition (+). // The correct evaluation is 5 + (2 * (3^2)) -> 5 + (2 * 9) -> 5 + 18 -> 23. Console.WriteLine(uc.EvalStr("5 + 2 * 3^2"));
#include
#include "uCalc.h"
using namespace std;
using namespace uCalcSoftware;
int main() {
uCalc uc;
// This tests the precedence of power (^), multiplication (*), and addition (+).
// The correct evaluation is 5 + (2 * (3^2)) -> 5 + (2 * 9) -> 5 + 18 -> 23.
cout << uc.EvalStr("5 + 2 * 3^2") << endl;
}
23 #include <iostream> #include "uCalc.h" using namespace std; using namespace uCalcSoftware; int main() { uCalc uc; // This tests the precedence of power (^), multiplication (*), and addition (+). // The correct evaluation is 5 + (2 * (3^2)) -> 5 + (2 * 9) -> 5 + 18 -> 23. cout << uc.EvalStr("5 + 2 * 3^2") << endl; }
Imports System
Imports uCalcSoftware
Public Module Program
Public Sub Main()
Dim uc As New uCalc()
'// This tests the precedence of power (^), multiplication (*), and addition (+).
'// The correct evaluation is 5 + (2 * (3^2)) -> 5 + (2 * 9) -> 5 + 18 -> 23.
Console.WriteLine(uc.EvalStr("5 + 2 * 3^2"))
End Sub
End Module
23 Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() '// This tests the precedence of power (^), multiplication (*), and addition (+). '// The correct evaluation is 5 + (2 * (3^2)) -> 5 + (2 * 9) -> 5 + 18 -> 23. Console.WriteLine(uc.EvalStr("5 + 2 * 3^2")) End Sub End Module