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

Exercise 1-11. test the word count program

This commit is contained in:
Kris Lamoureux 2021-11-12 23:55:56 -05:00
parent d064db2b17
commit 0c2d0fae2b
Signed by: kris
GPG Key ID: 3EDA9C3441EDA925

View File

@ -152,3 +152,68 @@ https://github.com/krislamo/knrc/commit/588969b09fabab1e91ff4f4b1c37e87fc23cf76b
https://github.com/krislamo/knrc/blob/588969b09fabab1e91ff4f4b1c37e87fc23cf76b/02-vars-and-math.c[(Source)] https://github.com/krislamo/knrc/blob/588969b09fabab1e91ff4f4b1c37e87fc23cf76b/02-vars-and-math.c[(Source)]
Move some numbers around to reverse the table. Move some numbers around to reverse the table.
09-word-count.c
~~~~~~~~~~~~~~~~
https://github.com/krislamo/knrc/commit/d064db2b171e3da74fd5082ae29456f64caeafeb[(Diff)]
https://github.com/krislamo/knrc/blob/d064db2b171e3da74fd5082ae29456f64caeafeb/09-word-count.c[(Source)]
Textbook example of counting lines, words, and characters from input.
Exercise 1-11: test the word count program
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
No input:
----
$ ./bin/09-word-count
0 0 0
$
----
Just 3 newlines:
----
$ ./bin/09-word-count
3 0 3
$
----
Just 3 tabs:
----
$ ./bin/09-word-count
0 0 3
$
----
Just 3 spaces:
----
$ ./bin/09-word-count
0 0 3
$
----
Just a single word per line:
----
$ ./bin/09-word-count
one
word
per
line
4 4 18
$
----
Three blanks before and after:
----
$ ./bin/09-word-count
three blanks before/after 0 3 31
$
----