Parcourir la source

Загрузить файлы ''

21IS15 il y a 1 an
Parent
commit
49ea786d16
1 fichiers modifiés avec 47 ajouts et 0 suppressions
  1. 47 0
      Form1_Lab5.cs

+ 47 - 0
Form1_Lab5.cs

@@ -0,0 +1,47 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Data;
+using System.Drawing;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows.Forms;
+
+namespace UP_5
+{
+    public partial class Form1 : Form
+    {
+        public Form1()
+        {
+            InitializeComponent();
+        }
+
+        private void Form1_Load(object sender, EventArgs e)
+        {
+
+        }
+
+        private void button1_Click(object sender, EventArgs e)
+        {
+            string text = textBox1.Text; // получаем текст из текстового поля
+            string result = ""; // строка для результата замены
+
+            foreach (char c in text) // перебираем все символы в тексте
+            {
+                if (c == 'А') // если символ - большая буква А
+                {
+                    result += '*'; // заменяем на звездочку
+                }
+                else
+                {
+                    result += c; // иначе оставляем символ без изменений
+                }
+            }
+
+            listBox1.Items.Add(result); // добавляем результат в ListBox
+        }
+
+        
+    }
+}