From a308f2a8f77c8242343bb1c842dcbf8d826ab81e Mon Sep 17 00:00:00 2001 From: John Christman Date: Wed, 3 Apr 2019 19:02:28 -0400 Subject: [PATCH] added pause at --- Calc1/Program.cs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Calc1/Program.cs b/Calc1/Program.cs index bbd95e3..689396f 100644 --- a/Calc1/Program.cs +++ b/Calc1/Program.cs @@ -26,7 +26,19 @@ class Program { static void Main(string[] args) { + Run(args); + if (System.Diagnostics.Debugger.IsAttached) + { + //Give a chance to see the output before the window closes + Console.WriteLine(); + Console.WriteLine(@"Press Enter to exit"); + Console.ReadLine(); + } + } + + private static void Run(string[] args) + { var argBuilder = Initialize(args); //check to make sure we actually have an argument. @@ -49,7 +61,8 @@ static void Main(string[] args) Console.WriteLine(shunt.Item2); return; } - var rpn = shunt.Item1; + + var rpn = shunt.Item1; //calculate the result. var calcResult = CalculateRpn.RpnResult(rpn); @@ -61,7 +74,6 @@ static void Main(string[] args) } Console.WriteLine(calcResult.Item1); - } private static StringBuilder Initialize(string[] args)