diff --git a/The C Programming Language/1.10.c b/The C Programming Language/1.10.c new file mode 100644 index 0000000..8d5d2b2 --- /dev/null +++ b/The C Programming Language/1.10.c @@ -0,0 +1,35 @@ +#include + +#define PRINT 0 +#define SKIP 1 + +main() +{ + int c; + int state; + + while ((c = getchar()) != EOF) + { + state = PRINT; + if (c == '\t') + { + state = SKIP; + printf("\\t"); + } + if (c == '\\') + { + state = SKIP; + printf("\\\\"); + } + if (c == '\b') + { + state = SKIP; + printf("\\b"); + } + + if (state == PRINT) + { + putchar(c); + } + } +}