Advertisement
PavelMiridonov

Lab2 part 3 Miridonov

Nov 27th, 2020 (edited)
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.69 KB | None | 0 0
  1. private void button1_Click(object sender, EventArgs e)
  2.         {
  3.             string str1 = textBox1.Text;//переменная для ввода первого операнда
  4.             string str2 = textBox3.Text;//переменная для ввода второго операнда
  5.             string symbol = textBox4.Text;
  6.             string res = "";//переменная для вывода результата
  7.             if (comboBox1.SelectedIndex == 0) res = str1.Replace(symbol, str2);
  8.             else if (comboBox1.SelectedIndex == 1)
  9.             {
  10.                 res = str1.Remove(str1.IndexOf(symbol)) + str2;
  11.             }
  12.             label1.Text = res;
  13.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement