You must time the test yourself and ensure you comply with the conditions below.
digit_filter.c
which reads characters from its input
and writes character to its output.
Digits ('0' .. '9'), spaces and newline characters should be written unchanged.
All other characters should be replaced with a '.' character.
Your program should stop only at the end of input.
For example:
dcc -o digit_filter digit_filter.c ./digit_filter This is week 9 of COMP1511. .... .. .... 9 .. ....1511. I paid $10.50 for 3 cups of coffee . .... .10.50 ... 3 .... .. ...... i is the symbol for the square root of -1 . .. ... ...... ... ... ...... .... .. .1 0123456789abcdef 0123456789......
When you think your program is working you can autotest
to run some simple automated tests:
1511 autotest digit_filter
give cs1511 test09_digit_filter digit_filter.c
The mapping for digits will be given to your program as a single command line argument.
This command line argument will contain 10 characters. These are the characters the corresponding digit should be replaced with. For example, '0's should be replaced with the first character of the command line argument, '1' with the second character of the command line argument and so on.
Characters other than digits should not be changed.
Your program should stop only at the end of input.
For example:
dcc -o map_digits map_digits,c ./map_digits ABCDEFGHIJ 0123456789 ABCDEFGHIJ Andrew rocks! Andrew rocks! 6 * 7 = 42 G * H = EC This is week 9 of COMP1511 This is week J of COMPBFBB ./map_digits andrewrock two 4 eight 16 thirtytwo 64 two e eight nr thirtytwo re ./map_digits zyzuvtsrqp 1 2 4 8 16 32 64 128 256 y z v q ys uz sv yzq zts
You can assume that your program is given exactly one command line argument and it contains exactly 10 characters.
No error checking is necessary.
When you think your program is working you can autotest
to run some simple automated tests:
1511 autotest map_digits
give cs1511 test09_map_digits map_digits.c
Assume the only non-word characters are space and newline.
All other characters should be considered word characters.
A word is defined as a maximal non-empty sequence of word characters.
Multiple spaces or newline characters may separate words.
Match the output format below exactly:
dcc -o word_count word_count,c ./word_count The quick brown fox jumped over the lazy dog. 1 lines 9 words 46 characters ./word_count only three words 3 lines 3 words 29 characters ./word_count Are you saying 'Boo' or 'Boo-Urns'? 1 lines 6 words 36 characters ./word_count In this house, we obey the laws of thermodynamics! 2 lines 9 words 52 characters ./word_count Simpson, Homer Simpson He's the greatest guy in history From the Town of Springfield He's about to hit a chestnut tree. 5 lines 21 words 125 characters
When you think your program is working you can autotest
to run some simple automated tests:
1511 autotest word_count
give cs1511 test09_word_count word_count.c
You can run give multiple times. Only your last submission will be marked.
Don't submit any exercises you haven't attempted.
If you are working at home, you may find it more convenient to upload your work via give's web interface.
Remember you have until Wednesday 9 May 23:59:59 to complete this test.
Automarking will be run several days after the submission deadline for the test. When complete you can view automarking here and you can view the the resulting mark via give's web interface