private void buttonravno_Click(object sender, EventArgs e) { if (!buttonMul.Enabled) { label1.Text = C.Multiply(Convert.ToDouble(label1.Text)).ToString(); } if (!buttonDiv.Enabled) { label1.Text = C.Div(Convert.ToDouble(label1.Text)).ToString(); } if (!buttonSum.Enabled) { label1.Text = C.Sum(Convert.ToDouble(label1.Text)).ToString(); } if (!buttonSub.Enabled) { label1.Text = C.Subtractions(Convert.ToDouble(label1.Text)).ToString(); } if (!buttonProis.Enabled) { label1.Text = C.ProisStep(Convert.ToDouble(label1.Text)).ToString(); } C.Clear_A(); Freebuttons(); }
void Start() { int choice = 0; decimal d1 = 0; decimal d2 = 0; var validChoices = new int[] { 1, 2, 3, 4, 5 }; var firstPrompt = "\n\nChoose Calc type \r\n1. Add\r\n2. Subtract\r\n3. Multiply\r\n4. Divide\r\n5. Exit\r\nSelection: "; var firstNumberPrompt = "Enter first decimal: \r\n"; var secondNumberPrompt = "Enter second decimal: \r\n"; do { Console.WriteLine(firstPrompt); choice = int.Parse(Console.ReadLine()); if (choice != 5 && validChoices.Contains(choice)) { d1 = GetDecimalInput(firstNumberPrompt); d2 = GetDecimalInput(secondNumberPrompt); } switch (choice) { case 1: Console.WriteLine($"the result is: {Calc.Add(d1, d2)}"); break; case 2: Console.WriteLine($"the result is: {Calc.Subract(d1, d2)}"); break; case 3: Console.WriteLine($"the result is: {Calc.Multiply(d1, d2)}"); break; case 4: Console.WriteLine($"the result is: {Calc.Divide(d1, d2)}"); break; case 5: choice = 99; break; default: Console.WriteLine("Invalid Selection: \r\n"); break; } } while (validChoices.Contains(choice)); Console.ReadLine(); }