Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string slovo = txbSlovo.Text;
- int šifraLiche = Convert.ToInt32(txbŠifra1.Text);
- int šifraSude = Convert.ToInt32(txbŠifra2.Text);
- txbVysledek.Text = null;
- char[] věta = slovo.ToCharArray();
- foreach (char pismeno in věta)
- {
- if (pismeno >= 'A' && pismeno <= 'Z')
- {
- if ((pismeno + šifraLiche) > 'Z')
- {
- txbVysledek.Text += Convert.ToChar((pismeno + šifraLiche) - 26).ToString();
- }
- else
- {
- txbVysledek.Text += Convert.ToChar(pismeno + šifraLiche).ToString();
- }
- }
- if (pismeno >= 'a' && pismeno <= 'z')
- {
- if ((pismeno + šifraLiche) > 'z')
- {
- txbVysledek.Text += Convert.ToChar((pismeno + šifraLiche) - 26).ToString();
- }
- else
- {
- txbVysledek.Text += Convert.ToChar(pismeno + šifraLiche).ToString();
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement