static void Main(string[] args) { Console.WriteLine("Сложение"); var calculator = new Calculator(); double result = 0; result = calculator.Add(5); Console.WriteLine(result); result = calculator.Add(4); Console.WriteLine(result); result = calculator.Add(3); Console.WriteLine(result); result = calculator.Redo(); Console.WriteLine(result); result = calculator.Undo(); Console.WriteLine(result); result = calculator.Undo(3); Console.WriteLine(result); result = calculator.Redo(3); Console.WriteLine(result); Console.WriteLine("Вычитание"); var calculator1 = new Calculator(); result = calculator1.Add(10); Console.WriteLine(result); result = calculator1.Sub(4); Console.WriteLine(result); result = calculator1.Sub(3); Console.WriteLine(result); result = calculator1.Redo(); Console.WriteLine(result); result = calculator1.Undo(); Console.WriteLine(result); result = calculator1.Undo(2); Console.WriteLine(result); result = calculator1.Redo(3); Console.WriteLine(result); Console.WriteLine("Умножение"); var calculator2 = new Calculator(); result = calculator2.Add(2); Console.WriteLine(result); result = calculator2.Mul(4); Console.WriteLine(result); result = calculator2.Mul(3); Console.WriteLine(result); result = calculator2.Redo(); Console.WriteLine(result); result = calculator2.Undo(); Console.WriteLine(result); result = calculator2.Undo(2); Console.WriteLine(result); result = calculator2.Redo(3); Console.WriteLine(result); Console.WriteLine("Вычитание"); var calculator3 = new Calculator(); result = calculator3.Add(10); Console.WriteLine(result); result = calculator3.Div(2); Console.WriteLine(result); result = calculator3.Div(5); Console.WriteLine(result); result = calculator3.Undo(); Console.WriteLine(result); result = calculator3.Redo(); Console.WriteLine(result); result = calculator3.Undo(2); Console.WriteLine(result); result = calculator3.Redo(2); Console.WriteLine(result); }
static void Main(string[] args) { var calculator = new Calculator(); double result = 0; result = calculator.Add(5); Console.WriteLine("Result: {0}", result); result = calculator.Add(45); Console.WriteLine("Result: {0}", result); result = calculator.Add(9); Console.WriteLine("Result: {0}", result); result = calculator.Mult(3); Console.WriteLine("Result: {0}", result); result = calculator.Sub(7); Console.WriteLine("Result: {0}", result); result = calculator.Divide(5); Console.WriteLine("Result: {0}", result); result = calculator.Redo(2); Console.WriteLine("Redo result: {0}", result); result = calculator.Undo(1); Console.WriteLine("Undo result: {0}", result); }
static void Main(string[] args) { var calculator = new Calculator(); double result = 0; result = calculator.Add(2); Console.WriteLine(result); result = calculator.Add(2); Console.WriteLine(result); result = calculator.Add(2); Console.WriteLine(result); result = calculator.Redo(); Console.WriteLine(result); result = calculator.Undo(3); Console.WriteLine(result); result = calculator.Undo(); Console.WriteLine(result); result = calculator.Undo(3); Console.WriteLine(result); Console.Read(); }
static void Main(string[] args) { var calculator = new Calculator(); double result = 0; result = calculator.Add(5); Console.WriteLine(result); result = calculator.Subtract(4); Console.WriteLine(result); result = calculator.Multiply(4); Console.WriteLine(result); result = calculator.Divide(2); Console.WriteLine(result); result = calculator.Redo(2); Console.WriteLine(result); result = calculator.Undo(2); Console.WriteLine(result); }
static void Main(string[] args) { var calculator = new Calculator(); int result = 0; result = calculator.Add(5); Console.WriteLine(result); result = calculator.Sub(3); Console.WriteLine(result); result = calculator.Undo(2); Console.WriteLine(result); result = calculator.Redo(2); Console.WriteLine(result); Console.ReadLine(); }
static void RunExample() { var calculator = new Calculator(); var result = calculator.Add(5); Console.WriteLine("{0} = {1}", 5, result); result = calculator.Add(12); Console.WriteLine("{0} = {1}", 5 + 12, result); result = calculator.Undo(1); Console.WriteLine("{0} = {1}", 5, result); result = calculator.Redo(1); Console.WriteLine("{0} = {1}", 5 + 12, result); }
static void Main(string[] args) { var calculator = new Calculator(); double result = 0; /*result = calculator.Add(5); * Console.WriteLine(result); * result = calculator.Add(4); * Console.WriteLine(result); * result = calculator.Add(3); * Console.WriteLine(result); * result = calculator.Redo(2); * Console.WriteLine(result); * result = calculator.Undo(1); * Console.WriteLine(result); * result = calculator.Mul(3); * Console.WriteLine(result); * result = calculator.Div(2); * Console.WriteLine(result); * result = calculator.Sub(3); * Console.WriteLine(result); * result = calculator.Add(5); * Console.WriteLine(result); * result = calculator.Undo(2); * Console.WriteLine(result);*/ result = calculator.Add(5); Console.WriteLine(result); result = calculator.Mul(6); Console.WriteLine(result); result = calculator.Sub(6); Console.WriteLine(result); result = calculator.Div(2); Console.WriteLine(result); result = calculator.Redo(2); Console.WriteLine(result); result = calculator.Undo(1); Console.WriteLine(result); Console.ReadKey(); }
static void Main() { Calculator calculator = new Calculator(); int result = 0; result = calculator.Add(5); Console.WriteLine(result); result = calculator.Sub(3); Console.WriteLine(result); Console.WriteLine(new string('-', 3)); result = calculator.Undo(2); Console.WriteLine(result); result = calculator.Redo(1); Console.WriteLine(result); // Delay. Console.ReadKey(); }