cypher1.c 621 B

1234567891011121314151617181920
  1. // cypher1.c -- alters input, preserving spaces
  2. #include <stdio.h>
  3. #define SPACE ' ' // that's quote-space-quote
  4. int main(void)
  5. {
  6. char ch;
  7. ch = getchar(); // read a character
  8. while (ch != '\n') // while not end of line
  9. {
  10. if (ch == SPACE) // leave the space
  11. putchar(ch); // character unchanged
  12. else
  13. putchar(ch + 1); // change other characters
  14. ch = getchar(); // get next character
  15. }
  16. putchar(ch); // print the newline
  17. return 0;
  18. }