K&R Task Exercise 5.17
Can someone explain what specifically needs to be done in exercise 5.17, what does it me开发者_运维知识库an to sort within line, its field?
I don't have my copy of K&R here. I think it means this
Suppose the original file has
0000087423 Volkswagen 2001-01-01 0000642396 Fiat 2002-02-02 3900063521 Renault 2003-03-03
It is already sorted by the 1st field; if you want to sort it by the 2nd field (the name) the result would be
0000642396 Fiat 2002-02-02 3900063521 Renault 2003-03-03 0000087423 Volkswagen 2001-01-01
Or you can sort by date (the 3rd field)
You must find a way to split a line into fields and then be able to say "sort on field N"
精彩评论