mirror of
https://github.com/krislamo/knrc.git
synced 2024-11-10 00:30:35 +00:00
Exercise 1-10. replace with escape codes
This commit is contained in:
parent
a8ca4de90f
commit
d8a70f8b58
17
08-unambiguous.c
Normal file
17
08-unambiguous.c
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
5
Makefile
5
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
|
hello: 01-hello-world.c
|
||||||
gcc -o ./bin/01-helloworld 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
|
blanks: 07-extra-blanks.c
|
||||||
gcc -o ./bin/07-extra-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:
|
clean:
|
||||||
$(RM) ./bin/*-*
|
$(RM) ./bin/*-*
|
||||||
|
Loading…
Reference in New Issue
Block a user