Advertisement
Guest User

Untitled

a guest
Jan 16th, 2019
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. void deCaesar(FILE * input, FILE * output, int shift) {
  2. if (input == NULL || output == NULL)
  3. return;
  4.  
  5. char c;
  6. shift %= 26;
  7.  
  8. while ((c = fgetc(input)) != EOF)
  9. {
  10. if (c >= 65 && c <= 90)
  11. {
  12. if (c - shift >= 65)
  13. c -= shift;
  14. else
  15. c = c - shift + 26;
  16. }
  17.  
  18. if (c >= 97 && c <= 122)
  19. {
  20. if (c - shift >= 97)
  21. c -= shift;
  22. else
  23. c = c - shift + 26;
  24. }
  25.  
  26. fputc(c, output);
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement