1
0
mirror of https://github.com/krislamo/knrc.git synced 2024-11-10 00:30:35 +00:00

Exercise 1-9. Replace multiple blanks with one

This commit is contained in:
Kris Lamoureux 2021-11-11 23:04:06 -05:00
parent 93acdbe7e9
commit a8ca4de90f
Signed by: kris
GPG Key ID: 3EDA9C3441EDA925
2 changed files with 20 additions and 1 deletions

16
07-extra-blanks.c Normal file
View File

@ -0,0 +1,16 @@
#include <stdio.h>
int main()
{
int c;
int l;
while ((c = getchar()) != EOF) {
if (c == ' ' && c == l) {
;
} else {
printf("%c", c);
l = c;
}
}
}

View File

@ -1,4 +1,4 @@
all: hello mathvars c2f input count countlines all: hello mathvars c2f input count countlines blanks
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
@ -18,5 +18,8 @@ count: 05-char-counting.c
countlines: 06-line-count.c countlines: 06-line-count.c
gcc -o ./bin/06-line-count 06-line-count.c gcc -o ./bin/06-line-count 06-line-count.c
blanks: 07-extra-blanks.c
gcc -o ./bin/07-extra-blanks 07-extra-blanks.c
clean: clean:
$(RM) ./bin/*-* $(RM) ./bin/*-*