private void button15_Click(object sender, EventArgs e) { if (operation_performed == "+") { textBox_Result.Text = Logic.Add(result_value, Double.Parse(textBox_Result.Text)).ToString(); } else if (operation_performed == "-") { textBox_Result.Text = Logic.Sub(result_value, Double.Parse(textBox_Result.Text)).ToString(); } else if (operation_performed == "÷") { if (Double.Parse(textBox_Result.Text) != 0) { textBox_Result.Text = Logic.Div(result_value, Double.Parse(textBox_Result.Text)).ToString(); } else { iszero = true; } } else if (operation_performed == "NOD") { textBox_Result.Text = Logic.Nod(result_value, Double.Parse(textBox_Result.Text)).ToString(); } else if (operation_performed == "X") { textBox_Result.Text = Logic.Times(result_value, Double.Parse(textBox_Result.Text)).ToString(); } if (!iszero) { result_value = Double.Parse(textBox_Result.Text); } else if (iszero) { textBox_Result.Text = "Учи матешу!"; } operation_performed = ""; }
static void Main(string[] args) { var input = int.Parse(Console.ReadLine()); var card = new Card(input, 11); var r = card.Rank; card.Suit = 14; var num1 = GetNumber("Give me the first number"); Console.WriteLine("What ist he operation?"); var op = GetOperation(); var num2 = GetNumber("Give me the second number"); var answer = 0; switch (op) { case Operations.Add: answer = Logic.Add(num1, num2); break; case Operations.Subtract: answer = Logic.Subtract(num1, num2); break; case Operations.Multiply: answer = Logic.Multiply(num1, num2); break; case Operations.Divide: answer = Logic.Division(num1, num2); break; } Console.WriteLine($"{num1} {op} {num2} = {answer}"); Console.ReadLine(); }