Advertisement
Guest User

Untitled

a guest
Feb 24th, 2020
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. char shiftAlphaCharacter(char c, int n) {
  2. if ((c >= 65 and c <= 90)) {
  3. if (n > 25) {
  4. n = n % 25;
  5. }
  6. c = c + n;
  7. if (c > 90) {
  8. c = c - n;
  9. int diff;
  10. diff = n - (90 - c) - 1;
  11. c = 65 + diff;
  12. }
  13. }
  14. else if ((c >= 97 and c <= 122)) {
  15. if (n > 25) {
  16. n = n % 25;
  17. }
  18. c = c + n;
  19. if (c > 122) {
  20. c = c - n;
  21. int diff;
  22. diff = n - (122 - c) - 1;
  23. c = 97 + diff;
  24. }
  25. }
  26. return c;
  27. }
  28.  
  29. int main() {
  30. cout << shiftAlphaCharacter('x', 33);
  31. return 0;
  32. }
  33.  
  34. console cout's 'Ç'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement