#K10776. Interactive Quiz Game

    ID: 23322 Type: Default 1000ms 256MiB

Interactive Quiz Game

Interactive Quiz Game

In this problem, you are required to implement an interactive quiz game. The game works as follows:

1. The program first reads an integer ( n ) from standard input which represents the number of quiz questions.
2. The next ( n ) lines each contain a quiz question and its correct answer separated by a comma. Note that any extra lines beyond these ( n ) questions should be ignored.
3. After reading the quiz configuration, the program will ask each question in order. For each question, it should display a prompt in the format Question i: [question] (where ( i ) is the question number starting from 1), read a user answer from standard input, and then print either Question i: Correct or Question i: Incorrect according to an exact string match with the correct answer.
4. Finally, after processing all questions, the program displays a summary line: You got x out of n correct! where ( x ) is the number of correct answers.

inputFormat

The input is given via standard input (stdin).

The first line contains a single integer ( n ) (the number of questions).
The next ( n ) lines each contain a question and its correct answer, separated by a comma.
After that, there will be ( n ) additional lines where each line represents the user's answer to the corresponding question.

outputFormat

The output should be printed to standard output (stdout).

For each question, output a line indicating whether the answer is correct or incorrect in the format:
Question i: Correct or Question i: Incorrect
Finally, output a summary line in the format:
You got x out of n correct!## sample

3
What is the capital of France?,Paris
What is 2+2?,4
Who wrote 'Hamlet'?,Shakespeare
Paris
4
Shakespeare
Question 1: Correct

Question 2: Correct Question 3: Correct You got 3 out of 3 correct!

</p>