diff --git a/08-unambiguous.c b/08-unambiguous.c new file mode 100644 index 0000000..11ddfff --- /dev/null +++ b/08-unambiguous.c @@ -0,0 +1,17 @@ +#include + +int main() +{ + int c; + + while ((c = getchar()) != EOF) { + if (c == '\t') + printf("\\t"); + else if (c == '\b') + printf("\\b"); + else if (c == '\\') + printf("\\\\"); + else + printf("%c", c); + } +} diff --git a/Makefile b/Makefile index babb6b7..f34ca9c 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -all: hello mathvars c2f input count countlines blanks +all: hello mathvars c2f input count countlines blanks unambiguous hello: 01-hello-world.c gcc -o ./bin/01-helloworld 01-hello-world.c @@ -21,5 +21,8 @@ countlines: 06-line-count.c blanks: 07-extra-blanks.c gcc -o ./bin/07-extra-blanks 07-extra-blanks.c +unambiguous: 08-unambiguous.c + gcc -o ./bin/08-unambiguous 08-unambiguous.c + clean: $(RM) ./bin/*-*