Due: Thursday, March 1st, 2012 9:10am
Start with numlist.c from io.zip, but change it to read a list of space-separated strings instead of space-separated numbers.
For example, the input
apple banana coconut .
should parse as the list that contains “apple”, “banana”, and “coconut”.
Of course, this program will work only for lists of strings where no string is supposed to contain a space and no string starts with a period.
Change you program so that ! followed by a space is treated as a space inside the string, instead of a ! in a string followed by a string-separating space. Also, treat !! as a ! in a string, and treat !. as a period in a string. Any character after ! other than a space, !, or . is an error.
For example, the input
apple! pie banana! split coconut! cream! pie!! !. donut .
should parse as the list that contains “apple pie”, “banana split”, “coconut cream pie!”, “.”, and “donut”.
Last update: Monday, February 27th, 2012mflatt@cs.utah.edu |