Image

Imageprotozoa wrote in Imagecpp


Here is a challenge. Imagemadbassist mentioned an assignment he had about reading names and scores from a
file and sorting them and then outputting them to a file. I was thinking with the standard library it can be done
with the minimum of code. The challenge is can you read in this file


John Smith 80
Charlie Brown 33
George Bush 10
Ally McBeal 86
Santa Claus 100

John Smith 90
Charlie Brown 44
George Bush 11
Ally McBeal 94
Santa Claus 100

John Smith 100
Charlie Brown 55
George Bush 12
Ally McBeal 87
Santa Claus 100

and output to standard out
Brown,	Charlie		Scores: 33 44 55 	Average: 44
Bush,	George		Scores: 10 11 12 	Average: 11
Claus,	Santa		Scores: 100 100 100 	Average: 100
McBeal,	Ally		Scores: 86 94 87 	Average: 89
Smith,	John		Scores: 80 90 100 	Average: 90



in less than 23 lines of code? I've used normal formatting, no tricks (without counting curly braces it's 17 lines).
main() is 26 lines long, with includes and such the program is 34 lines long total.