Advertisement
Agrovein

Polybius

Mar 4th, 2021
974
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.14 KB | None | 0 0
  1. string[] alphabet = new string[] { "а", "б", "в", "г", "ґ", "д", "е", "є", "ж","з", "и", "і", "ї", "й", "к", "л","м", "н", "о",
  2.                "п", "р", "с","т", "у", "ф", "х", "ц", "ч", "ш", "щ", "ь", "ю", "я", ",", ".", " " };
  3.  
  4.             if (radioButton1.Checked)
  5.             {
  6.                 string text_before_cr = textBox1.Text;
  7.                 textBox2.Text = "";
  8.  
  9.                 foreach (char letter in text_before_cr)
  10.                 {                                          
  11.                         for (int i = 0; i < alphabet.Length; i++)
  12.                         {
  13.                             if (letter.ToString().ToLower() == alphabet[i] && i < alphabet.Length - 6)
  14.                             {
  15.                                 textBox2.Text += alphabet[i + 6];
  16.                             }
  17.                             else if (letter.ToString().ToLower() == alphabet[i] && i > alphabet.Length - 7)
  18.                             {
  19.                                 textBox2.Text += alphabet[i - 6];
  20.                             }
  21.                         }
  22.                 }              
  23.             }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement