This assignment is due Friday night, January 30, at 11:59pm. It's an individual assignment; do your own work. Submit your solution to Expertiza as you did with assignment 1.
Write a program named processLines.c that processes input lines as follows.
After reading a line, it removes the character '#' and any characters that follow it from the line. If after that removal, the line consists entirely of white space, it is discarded.
A line containing some non-whitespace is assigned a number. Numbers start at zero and increase by one for each nonblank line.
If any word on the line ends with a colon (':'), the word is printed, followed by a tab (\t), followed by the current line number, followed by a newline.
Here's an example, with input given on the left and explanation on the right.
foo # a: bbb: b c: # hello there d: hello world # xyz e: |
foo is on line 0 the result of removing # and subsequent chars leaves a blank line a: appears on line 1 bbb: appears on line 2 two blank lines are ignored b and c: are on line 3 d: is on line 4 hello world is on line 5 e: is on line 6 |
The output is
a: 1 bbb: 2 c: 3 d: 4 e: 6
You may assume that lines are at most 80 characters long and words are at most 20 characters long.