repo.or.cz
/
KandRexercises.git
/
blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
log
|
graphiclog1
|
graphiclog2
|
commit
|
commitdiff
|
tree
|
refs
|
edit
|
fork
blame
|
history
|
raw
|
HEAD
started on 1-13
[KandRexercises.git]
/
charreplace.c
blob
153c35be9722e2a4cc4e935fa9668934c0aeed3f
1
#include <stdio.h>
2
/* exercise 1-10: replace, \, backspace and tab characters */
3
4
main
() {
5
int
c
;
6
while
((
c
=
getchar
()) !=
EOF
) {
7
8
if
(
c
==
'
\t
'
) {
9
putchar
(
'
\\
'
);
10
putchar
(
't'
);
11
}
else if
(
c
==
'
\\
'
) {
12
putchar
(
'
\\
'
);
13
putchar
(
'
\\
'
);
14
}
else if
(
c
==
'
\b
'
) {
15
putchar
(
'
\\
'
);
16
putchar
(
'b'
);
17
}
else
{
18
putchar
(
c
);
19
}
20
21
}
22
putchar
(
'
\n
'
);
23
}