Advertisement
Guest User

Untitled

a guest
May 22nd, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. string slovo = txbSlovo.Text;
  2. int šifraLiche = Convert.ToInt32(txbŠifra1.Text);
  3. int šifraSude = Convert.ToInt32(txbŠifra2.Text);
  4. txbVysledek.Text = null;
  5. char[] věta = slovo.ToCharArray();
  6.  
  7.  
  8. foreach (char pismeno in věta)
  9. {
  10. if (pismeno >= 'A' && pismeno <= 'Z')
  11. {
  12. if ((pismeno + šifraLiche) > 'Z')
  13. {
  14. txbVysledek.Text += Convert.ToChar((pismeno + šifraLiche) - 26).ToString();
  15. }
  16. else
  17. {
  18. txbVysledek.Text += Convert.ToChar(pismeno + šifraLiche).ToString();
  19. }
  20. }
  21. if (pismeno >= 'a' && pismeno <= 'z')
  22. {
  23. if ((pismeno + šifraLiche) > 'z')
  24. {
  25. txbVysledek.Text += Convert.ToChar((pismeno + šifraLiche) - 26).ToString();
  26. }
  27. else
  28. {
  29. txbVysledek.Text += Convert.ToChar(pismeno + šifraLiche).ToString();
  30. }
  31. }
  32. }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement