using uCalcSoftware;

var uc = new uCalc();
string display_text = "";

// Simulate user pressing buttons: 1, 2, 3, +, 4, 5, 6
display_text = display_text + "123";
Console.WriteLine($"Display: {display_text}");

display_text = display_text + "+";
Console.WriteLine($"Display: {display_text}");

display_text = display_text + "456";
Console.WriteLine($"Display: {display_text}");

// Simulate pressing '='. This is where uCalc does the work.
var result = uc.EvalStr(display_text);
display_text = result;
Console.WriteLine($"Result: {display_text}");

Console.WriteLine("");

// Simulate a new calculation with an error
display_text = "5 * / 3";
Console.WriteLine($"Display: {display_text}");
result = uc.EvalStr(display_text);
display_text = result;
Console.WriteLine($"Result: {display_text}");

Console.WriteLine("");

// Simulate clearing the display
display_text = "C"; // Let's say 'C' is a special command
if (display_text == "C") {
   display_text = "";
}
Console.WriteLine($"Display after clear: '{display_text}'");