1
0

cypher2.c 467 B

123456789101112131415161718
  1. // cypher2.c -- alters input, preserving non-letters
  2. #include <stdio.h>
  3. #include <ctype.h> // for isalpha()
  4. int main(void)
  5. {
  6. char ch;
  7. while ((ch = getchar()) != '\n')
  8. {
  9. if (isalpha(ch)) // if a letter,
  10. putchar(ch + 1); // display next letter
  11. else // otherwise,
  12. putchar(ch); // display as is
  13. }
  14. putchar(ch); // display the newline
  15. return 0;
  16. }