DWITE Online Computer Programming Contest, December 2009, Problem 1
Building "quiz" applications is a popular assignment/project/whatever task for students learning programming. There are many that type up 500+ lines of code, but trust me — we can do that in much less.
The idea is that we will de-couple data from code. The questions and answers themselves are not code, they are just data, and so should live in a separate data file. As such, we only need enough actual programming to display just one question — any question read from a data file. To make things more interesting though, we'll be reading the questions out of a data file in a "random" order.
The input will contain 5 sets of input: a question line no more than 255 characters long, followed by a "random" integer, order on which line the question should appear in the output. (Since we can't mark against actual random results, we'll tell you what "random" values to use).
The output will contain 5 lines, questions from the data file, arranged in the specified order.
Sample Input
question one
4
question two?
5
DWITE
2
What city is the capital of Canada?
3
meep.
1
Sample Output
meep.
DWITE
What city is the capital of Canada?
question one
question two?
Problem Resource: DWITE
Comments